0

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
-----------------------------------
Manoj
  • 65
  • 2
  • 9

1 Answers1

0

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;
   }
}