I got that. never mind.

$this->Question->recursive = 1;

is the answer.

Thanks,
kiran

On Mon, Mar 5, 2012 at 2:51 PM, Kiran Ambati <[email protected]> wrote:

> Hi All,
>
> I am using a model named 'Questions' It has relationships hasMany and
> belongsTo with few other models. Now I want to fetch data in controller
> such that i get all associated data for particular record in questions
> table.
>
> For eg: - If I input a question_id = 1. I should get all the related data
> from other related models where question_id = 1 .
>
> i have tried this.
>
> $this->Question
> ->find('all',array('condition'=>array('Question.question_id'=>1)));
>
> $this->Question->User
> ->find('all',array('condition'=>array('Question.question_id'=>1)));
>
> approximate structure of query i am expecting should be
>
> select * from Questions,Users where Question.question_id=1 and
> Question.user_id=User.user_id;
>
>
>
> --
> *Thank you,*
> *Kiran.*
>
>


-- 
*Thank you,*
*Kiran.*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to