[eluser]Sport_Billy[/eluser]
Thanks for your reply WanWizard, it is nice to see you helping here.
I figured it out too that it cannot be supported the way i did it with include_related.
I ended up using subqueries and GROUP_CONCAT function, because it still does what i wanted.
Here is the code i used based on the example above in case someone has similar problem:
Code:
$customer = new Customer();
$deseases = $customer->desease;
$deseases->select_func('GROUP_CONCAT', '@desease_name', 'group_concat');
$deseases->where_related('customer', 'id', '${parent}.id');
$customer->select_subquery($deseases, 'desease_names');
$customer->get();
So the results for the example will come from this output:
Code:
foreach($customers as $c){
echo $c->firstname . $c->lastname;
echo "<br/>";
echo $c->desease_names;
echo "<br/>";
}
And will produce something like this:
Code:
John Smith
desease1, desease2