Hello again,
I begin to fall in love with Phalcon O:)
But I've got a little problem. I cannot get the idea of how to access fields from a many to many relationship in Volt-output.
I've got two tables: 'persons' and 'names'. I've got a third table named 'persons_lastnames' (yes, and another one 'persons_firsnames').
Now I wanted to show a table of all stored persons - I created one with phpmyadmin for the test. The models were all created by Phalcon-Dev-Tools (phalcon all-models --relations).
PersonsController: public function indexAction() { $this->view->title = 'LIST'; $this->view->persons = Persons::find(); }
index.volt: ... <tbody> {% for person in persons %} <tr> <td>{{person.id}}</td> <td>{{person.persons_lastnames.name}}</td> ...
The fields from Person are shown, but for the many-to-many-fields I got errors: Notice: Access to undefined property Persons::persons_lastnames in C:\xampp\htdocs\slipbox\app\cache\c__xampp_htdocs_slipbox_app_views_persons_index.volt.php on line 23
So next error is clear: Notice: Trying to get property of non-object in C:\xampp\htdocs\slipbox\app\cache\c__xampp_htdocs_slipbox_app_views_persons_index.volt.php on line 23
In the documentation I cannot find the clue how to access the variable. Do I have to make another Query in the model? Thaught Phalcon does the needed things automatically?!
Thanks a lot - again Aljoscha