Access to undefined property exception thrown in setter function when I fetch record by Example::findFirst($id)
E_USER_NOTICE: Access to undefined property Example::property_five in /path/to/Example.php on line xxx
class Example extends \Phalcon\Mvc\Model
{
...
public function setPropertyFour()
{
$this->property_four = $this->property_five;
}
}
The model function findFirst() accessing model setter functions to set value but it throws exception when it finds accessing other property of the same model which is $this->property_five next to $this->property_four in mysql table
Mysql table
-----------------------------------
id | property_four | property_five
-----------------------------------
1 | Manoj | Developer
-----------------------------------
May be already too late to answer this but... Have you declared your properties in your model?
class Example extends \Phalcon\Mvc\Model
{
public $property_four;
public $property_five;
public function setPropertyFour()
{
$this->property_four = $this->property_five;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.