Tuesday, February 28, 2012

Re: Filter on a deep model association

By filter I mean to select all authors where Collection is equal to a
collection_id and do it from the authors controller.
I can't simply do a $this->Author-
>find('all',array('conditions'=>array('Collection.id'=>
$collection_id)) because the Author model is not associated with the
Collection model.
Thanks for helping.

On 28 fév, 20:32, lowpass <zijn.digi...@gmail.com> wrote:
> What do you mean by filtered? Do you want to sort by Collection, or do
> you want to select only specific Collections?
>
> And which controller/model do you want to do this from? Because the
> models are associated, code from, eg. the Book model can run a find()
> from the Collection model. $this->Book->Collection->find(...)

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