[eluser]hudar[/eluser]
Hi, very glad to have an ORM for CI, great works.
Anyway, would you help me a bit since I'm a bit new to ORM.
Case :
we have 2 table :
Person Jobs
======= ============
id(PK) id(PK)
name person_id(FK)
address company
telp company_address
By using traditional query with select and join with single query, we can show result table as simple as this in view :
foreach($results as $r){
echo '<td>' . $r['id'] . '</td>';
echo '<td>' . $r['name'] . '</td>';
echo '<td>' . $r['company'] . '</td>';
echo '<td>' . $r['company_address' . '</td>'];
}
But I've found that in ORM we should do this way :
$person = $this->Person->find_all();
$related_person = $person->related('jobs');
$person_job = $related_person->get();
So we need 2 foreach, ones for $person, and other for jobs in view, isn't it?
Is there any way to do it on single foreach like we did on traditional join query ?
Thanks, great works again.