[eluser]KJSDFHASD78FASDF78SA[/eluser]
@Andre83:
This reminded me of the new query modifier I planned to add a few days ago:
fetching_related_*(). Which did the following.
Code:
$women = $this->woman->fetching_related_men('man')->find_all();
foreach ( $women as $woman )
{
echo $woman->name . ' relates to ';
foreach ( $woman->men as $man )
echo $man->name . ', ';
echo "\n";
}
However, this method increased the memory foot print of the script. So I ditched the idea altogether.
If one aims for speed it is ALWAYS better to fetch_related_*() for each object
returned by find_all(), rather than store ALL of them in the result array. E.g.
Code:
$women = $this->woman->find_all();
foreach ( $women as $woman )
{
echo $woman->name . ' relates to ';
foreach ( $woman->fetch_related_men('man') as $man )
echo $man->name . ', ';
echo "\n";
}
@ralf57: good ;-)