On Aug 3, 4:42 pm, pomares <[email protected]> wrote:
> I would like a select menu filled with clients sorted by advancement
> category. Here are the models
> Client belongsTo Family
add an order field to your find array, not in any of the contain sub-
arrays.

ie

'order'=>'AdvancementCategory.id ASC'

you also add order fields within your 'contain' sub arrays to sort
that subset within your larger dataset

> Family belongsTo Advancement (i.e. status)
> Advancement belongsTo AdvancementCategory.
>
> My code:
>
> function clientList() {
>         return $this->Client->find('all', array(
>                                                         'fields' => array(
>                                                                         'id',
>                                                                         
> 'firstname',
>                                                                         
> 'lastname',
>                                                                         
> 'family_id'),
>                                                         'contain' => array(
>                                                                         
> 'Family' => array(
>                                                                               
>           'fields' =>array(
>                                                                               
>                           'id',
>                                                                               
>                           'advancement_id'),
>                                                                               
>           'Advancement' => array(
>                                                                               
>                           'fields' =>array(
>                                                                               
>                                           'id',
>                                                                               
>                                           'advancement_category_id'),
>                                                                               
>                           'AdvancementCategory' => array(
>                                                                               
>                                           'fields' => array(
>                                                                               
>                                                           'id',
>                                                                               
>                                                           'name')))))
>                                                         ));
>         }
>
> Again, I would like the resulting array to be sorted by
> AdvancementCategory.id.
>
> How do I do that?
--~--~---------~--~----~------------~-------~--~----~
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