Oh yes, I didn't know about this Amit Badkas. Great solution! Thanks too.

2010/12/17 Flávio Ricardo <[email protected]>
>
> I don't understand why you are doing this.
>
> I think if you had a model called User wich hasOne UserProfile the
> more correct to you find a User and retrieve your UserProfile. The
> other solution is you  change the association to UserProfile belongsTo
> User and set a field user_id.
>
> So you use $this->UserProfile->find('list', array('conditions' =>
> array('user_id' => $id)));
>
> On Dec 16, 3:11 pm, psybear83 <[email protected]> wrote:
> > Hey everybody
> >
> > I want to use find('list') that uses conditions of joined tables. But
> > it seems find('list') doesn't support that?
> >
> > Example: I have a model User which hasOne UserProfile.
> >
> > $userProfile->find('all', array(
> >             'conditions' => array(
> >             )
> >           ));
> >
> > ...works like a charm, but...
> >
> > $userProfile->find('list', array(
> >             'conditions' => array(
> >               'User.id' => $id
> >             )
> >           ));
> >
> > ...tells me:
> >
> > SQL Error: 1054: Unknown column 'User.id' in 'where clause' [CORE/cake/
> > libs/model/datasources/dbo_source.php, line 684]
> >
> > Query: SELECT `UserProfile`.`id` FROM `user_profiles` AS `UserProfile`
> > WHERE `User`.`id` = 1102
> >
> > Evidently it doesn't join the hasOne table by itself... Is there a way
> > to force it to do it anyway?
> >
> > Thank you
> > Josh
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
>
> 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]<cake-php%[email protected]>For
>  more options, visit this group at
http://groups.google.com/group/cake-php?hl=en



--
Flávio Ricardo
(67) 9239 - 6922
Twitter - @flavioricardo
Blog - http://www.fricardo.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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