An IRC conversation gave me the solution : containable behavior had to  
be attached in the model and not in the controller.

On Apr 29, 2009, at 08:51 , Zeugme wrote:

> Hi,
>
> I'm not able to make containable fully work.
> I have a A with many B and I want to find A with their B but only  
> few fields.
>
> Here is what I did :
>        $this->set('A',
>        $this->A->find('all', array(
>           'conditions' => array ('A.id' => $id),
>              'fields' => array('id', 'name'), // OK
>              'contain' => array(
>                 'S' => array( // still OK
>                    'fields' => array('S.id', 'S.name', 'S.a_id') //  
> Do not work !
>                 )
> //              'D' // That was for testing relation and it worked  
> fine.
>              )
>        )));
>
>
> It work partially : I'm able to get S and/or D and this is cool to  
> select relations.
> But I'm not able to restrict field on S.
> The restriction (outside the containable) on A works fine.
> Any idea ?
>
> Models are OK.
> I try to follow the exemple given in the official doc,
> the last one here : http://book.cakephp.org/fr/view/474/Containable
>
> >


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

Reply via email to