Subject: access attributes has_many (don't know a better name for it)
Hi,
I got two classes: Person, Cars
one Person can has many Cars. Therefore my class Person has the "has__many" association.
Now my question: is it possible to access the cars of a person via:
___________________________________________________________________________________________
$person->cars; //returning an array of Cars or something similar
___________________________________________________________________________________________
Is it possible this way? Well, I tried it and it doesn't seem to work, but maybe i did something wrong...
Or do I have to do it always like:
Subject: access attributes has_many (don't know a better name for it)
Hi,
I got two classes: Person, Cars
one Person can has many Cars. Therefore my class Person has the "has__many" association.
Now my question: is it possible to access the cars of a person via:
___________________________________________________________________________________________
$person->cars; //returning an array of Cars or something similar
___________________________________________________________________________________________
Is it possible this way? Well, I tried it and it doesn't seem to work, but maybe i did something wrong...
Or do I have to do it always like:
___________________________________________________________________________________________
Car::all(array('conditions' => array('person_id' => $person->id)));
___________________________________________________________________________________________
br, mks
edit: maybe I should have posted it in the "Help-Forum" - sorry ;)