Hi, thanks for the answer but I just found out that I misread the docs.
I tried something like this: $data = $this->find('all', array( 'contain' => array( 'B' => array( 'contain' => array( 'C' ))))); which doesn't work. It has to be like this: $data = $this->find('all', array( 'contain' => array( 'B' => array( 'C' )))); The 'contain' key is only added for the first model. Thanks anyway. Regards Guenther Nature Lover wrote: > Hi! > > $AIds = $this->A->B->find('list', array('fields' => array('B.a_id'), > 'group' => array('B.a_id'))); > > 1.Try One: > $this->A->Behaviors->attach('Containable'); > $this->A->B->Behaviors->attach('Containable'); > $AsBsAndCs = $this->A->find('all', array > ('contain' => array('B' => array('contain' => 'C', 'fields' => array > ('C.id', 'C.b_id'))), 'fields' => array('B.id', 'B.a_id'))); > > If above dosen't work, try next. > > 2.Try Two: > $As = $this->A->find('all', array('conditions' => > array('A.id' => $AIds), 'order' => array('A.id' => 'ASC'))); > > $this->A->B->Behaviors->attach('Containable'); > $this->A->B->find('all', array('contain' => array > ('C' => array('fields' => array('C.id', 'C.b_id'))), 'conditions' => > array('B.a_id' => $AIds), 'order' => array('B.a_id' => 'ASC'), > 'fields' => array('B.id', 'B.a_id'))); > > This second will definitely work for you. > > > Best of Luck! > > Take Care! > > --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---