Monday, August 3, 2009

Re: Containable - Deep Associations - Sort resulting array

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')))))

'order'=>array('AdvancementCategory.id ASC'),
));
}

On Aug 3, 4:42 pm, pomares <k...@gordonpomarescentre.com> wrote:
> I would like a select menu filled with clients sorted by advancement
> category. Here are the models
> Client belongsTo Family
> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: