Welcome Guest, Not a member yet? Register   Sign In
dmz order_by on deep relationship
#1

[eluser]prestondocks[/eluser]
I am struggling to get order_by on a deep relationship to work

I have a tasks table which is related to a task_groups table, which is in turn related to a users table.

when I call $t = new Task() how can I then use order_by on the users related to task_groups?

Thanks for any advise

Simon
#2

[eluser]prestondocks[/eluser]
I just worked it out myself. I had to first use the include_related command

$t->include_related('task_group/user',array('id','username'));

Then I could just use a simple order_by command.

$t->order_by('username','asc');


What great library DataMapper is. I can not do with out it any more.

Hope this helps someone.

Simon




Theme © iAndrew 2016 - Forum software by © MyBB