Add the contain into the find() itself, not a stand alone method.
'contain' => array('Author')
Can I see the array thats returned?
On Jan 8, 7:34 am, Lorenzo Bettini <[email protected]> wrote:
> Hi
>
> I've just started using the Containable behavior (which I put in AppModel).
>
> I have Paper <-> Author, where <-> is the HABTM and in my AuthorsPaper
> (join table related) model I have this method
>
> function paper_authors($id) {
> $this->recursive = 0;
> $this->contain('Author');
> $joinAuthors = $this->find('all',
> array(
> 'conditions' => array('AuthorsPaper.paper_id' => $id),
> 'order' =>
> 'AuthorsPaper.id'
> )
> );
>
> which retrieves the authors associated to a paper (without loading Paper
> information).
>
> This works perfectly.
>
> But If I use this method after calling a method on Paper's model class
> which does
>
> $this->contain(array(
> 'Author' => array(
> 'AuthorsPaper',
> 'order' => 'AuthorsPaper.id'
> )
> ));
>
> the above method (paper_authors in class AuthorsPaper) does not work
> anymore, meaning that it does not retrieve information about Author
> anymore...
>
> so does the method in Paper's class use of contain spoils any further
> contain called on related classes (e.g., AuthorsPaper)?
>
> thanks in advance
> Lorenzo
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
> BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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