would be repeated for each Author. I think the first is the way to go
because what you're really doing is viewing a Collection. The Books
and Authors are secondary.
To sort the Authors, I think you might be able to use the Set class.
But, if you can, I doubt it would be simple because your array will
look like:
Collection
Book
Author // possibly more than one here
Book
Author // possibly more than one here
etc.
Then there's also the possibility that a given Author is associated
with more than one Book in this Collection. So I think it would more
sensible to order the Books within the Collection, and the Authors
within Book.
$data = $this->Author->Book->Collection->find(
'first',
array(
'conditions' => array(
'Collection.id' = $c_id
),
'contain' => array(
'Book' => array(
'order' => array('Book.title' => 'ASC'),
'Author' => array(
'order' => array('Author.surname' => 'ASC'),
)
)
)
)
);
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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
No comments:
Post a Comment