Hi.

I can see that ORDER'ing related models have been discussed before,
but I haven't found a solution.

I basically have 3 tables/models: Item, User, Person

Item has $hasAndBelongsToMany = array('User');

and User has $belongsTo = array('Person');

Person has a field "name", and when I retrieve an item, I would like
the related users to be ordered by Person.name.

I tried to add an order clause to the HABTM-definition:
Item: $hasAndBelongsToMany = array('User'=>array
('order'=>'Person.name'));
- but this gives an SQL-error (Person.name not found).

I can see that Cake is not baking any JOINs for me - instead there is
a SELECT statement for each person in the SQL-log...

I have tried to experiment with "recursive", but that doesn't seem to
change anything. What is the Cake-way to sort like this?

  Regards

    Jonathan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to