Hi,
By default, find('list') sets recursion to -1. That's why you need to set
'recursive' => 0 in the options array, something like
$userProfile->find('list', array(
'conditions' => array(
'User.id' => $id
),
'recursive' => 0
));
Hope this helps.
Amit Badkas
PHP Applications for E-Biz: http://www.sanisoft.com
On Thu, Dec 16, 2010 at 11:41 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
>
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