If you are querying Category you specify the order for Catrgory in the
find, using order like normal. The SubCategory data will (should) use
the order specified in the relationship written in the Category model
and the order for Item should by default be what is defined in
SubCategory.
Using Containable you can override this by specifying order keys for
each associated Model set to be retrieved.
Something like:
'contain' => array(
'SubCategory' => array(
'order' => 'SubCategory.title ASC',
'Item' => array(
'order' => 'Item.name ASC'
)
)
)
On Jun 8, 11:10 am, fain182 <[email protected]> wrote:
> > Another hint:
> > When the data is not joined you can also do "dynamic" ordering on the
> > related data (not the primary data by the related values though) using
> > Containable Behaviour.
>
> i have model like this:
> category hasmany subcategory hasmany items..
> i want to order items by category and subcategory, using the order in
> the relationship, it works only for the category.. for example
> cat A : subcat 3, subcat 4
> cat B: subcat 1, subcat 2, subcat 5
>
> i want a view with:
> Cat A:
> subcat 3
> his items..
> subcat 4
> his items..
> Cat B:
> subcat 1
> his items..
> subcat 2
> his items..
> subcat 5
> his items..
>
> but using order in the relation i have:
>
> Cat B
> subcat 1
> his items..
> subcat 2
> his items..
> Cat A
> subcat 3
> his items..
> subcat 4
> his items..
> Cat B
> subcat 5
> his items..
>
> i should bind and unbind? how?
>
> --
> pietro
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---