Tuesday, April 28, 2009

find 'all' using containable issue

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