Wednesday, August 5, 2009

Paginate->sort by nested model?

Hi All,

I have successfully managed to get my paginate->sort to work with
associated models, and am now wondering if it could also sort by
models nested within associated models?! So, if my $this->paginate
results in something like:

Array
(
[0] => Array
(
[MainContent] => Array
(
[id] => 2
[associated_item_id] => 160
[title] => 'blah'
...
)

[AssociatedContent] => Array
(
[id] => 160
[parent_item_id] => 999
[title] => 'more blah'
[ParentContentItem] => Array
(
[id] => 999
[title] => 'even more blah'
)
)
)

could I sort by ParentContentItem.title?

$paginator->sort('Parent content',
'AssociatedContent.ParentContentItem.title') doesn't really look like
something that would work (and it doesn't appear to), I'm wondering if
there's another approach I could try?

Any tips would be much appreciated. Thanks in advance,

Toby
--~--~---------~--~----~------------~-------~--~----~
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: