Hi everyone,
I've read carefully https://docs.phalcon.io/en/latest/reference/models.html and in the 'Public properties vs. Setters/Getters' section, there's the following sentence : "The ORM is compatible with both schemes of defining properties.".
So I tried making the properties of my class private and added the corresponding (public) getters. So for instance, there's "private $fullName;" and "public function getFullName() { return $this->fullName; }" in my class. To be complete, I call ::find() in the controller followed by $this->view->setVar and finally in the .phtml, I use $p->fullName;
My first discovery is that $p->fullName don't call automagically getFullName (" Access to undefined property ..."). So I had to call it manually : $p->getFullName() And then I found that $this->fullName was failing inside getFullName ("Undefined variable: fullName"). From a pure class point of view, this should be valid but I guess it's caused by "extends \Phalcon\Mvc\Controller". So I changed my properties from private to protected and then $this->fullName was accessible.
Reading php docs, I discovered I had to implement/override magic isset and get functions if I really wanted to have my variable private but then, phalcon is not automating things anymore as I have to manually code everything..
So obviously, either phalcon has to evolve or the docs has to be updated .. only if I'm right of course.
Thanks for reading ^^