Look at the Containable behaviour: 
http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html

On 4 Jun 2014, at 14:47, ajt <[email protected]> wrote:

> Hi,
> 
> I just want to display fields from 3 tables which I have checked on how to do 
> this and I am not clear on this. Examples I have found concentrate on 2 
> fields or keyed in conditions on multiple tables.
> I have models all related in some way.
> I want the username from a tutorsession table and the middle table is the 
> teacher table.
> 
> Tutorsession - related to teacher
> Teacher -related to tutorsession and teacher
> User= related to teacher
> 
> The tutorsession automatically gets rows from teacher table but not user 
> table. I have checked the docs below and I am not sure what to use here as 
> the below doesnt work but I dont get errors.
> 
>   $this->set( 'tutor',$this->Tutorsession->find('all',array('conditions' => 
>                array('Teacher.user_id' => $id,'Teacher.user_id' => 
> 'User.id'))));
>        
> 
>       
>       $this->set( 'tutor',$this->Tutorsession->find('all',array('conditions' 
> => array('Teacher.user_id' => $id))));
>        
> 
> http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html
> http://book.cakephp.org/2.0/en/models/retrieving-your-data.html
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to