Hi,
I was wondering if anybody has thought about adding support for
"manual sorting" to Cake.
In my specific case, I need to paginate a model and want to order it
by the average score of ratings that are stored in another table
(Place hasMany Rating; ORDER BY AVG(Rating.score)). The best solution
I found so far, next to writing my own paginator, was to add a
condition like this to the paginate conditions:
1 = 1 ORDER BY FIELD(`Place`.`id`, 128, 97, ... ) DESC
where I'm getting the list of ids in a separate query in the right
order.
This works fine, but since I don't like the "1 = 1 hack" I was
wondering if there's a chance to get something like this into Cake:
find('all', array('order' => array('Place.id' => array(1, 2,
3, ... ))));
which would produce the above ORDER BY clause. I think that might come
in handy in other situations as well.
Chrs,
Dav
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---