Let's say I have three tables, like so:
people
------
id
name
credits
-------
id
person_id
event_id
position
events
-----
id
name
year
In the people model (as well as the events model), I have a one to many defined pointing to the credits. In the credits I have a belongsTo pointing to people, and one pointing to events.
I have a $person object that I get by:
$person = People::findFirst();
Now, I know that I can get access to events simply by:
$person->events;
// or:
$person->getEvents();
... but... how can I do this AND get access to the associated credit data as well? Is there a built in/Phalcon way, or do I just have to go through $person->credits?
Thanks!
EDIT:
In other words, is there a way to "include" associated data in the query? I know that, under the hood, it's doing a JOIN on credits. I'd love for that call to also include the credits in the SELECT statement. Is there a way to do this?