Hello John,

Works like a charm. Thanks for your time!

Dave 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of John Andersen
Sent: December-14-09 3:00 AM
To: CakePHP
Subject: Re: Contain Help

Hi Dave,

Try changing this:

[code]
>         'contain' => array(
>                 'Profile' => array(
>                         'conditions' => array(
>                         'Profile.id' => $auth_id)))
[/code]

into this:

[code]
>         'contain' => array('Profile')
[/code]

CakePHP should be able to identify the correct Profile by the model
relationships that you have specified.
Enjoy,
   John

On Dec 14, 2:27 am, "Dave" <[email protected]> wrote:
> Contain is not grabbing my related model and I don't know why. Tried 
> with fields or without and still nothing.
>
> public function getUser($auth_id)
>
>  {
>   $params = array(
>         'conditions' => array(
>                 'User.id' => $auth_id),
>         'fields' => array(
>                 'User.firstname',
>                 'User.lastname',
>                 'User.username',
>                 'User.email',
>                 'User.slug',
>                 'User.id',
>                 'User.reset',
>                 'User.confirm_code'),
>         'contain' => array(
>                 'Profile' => array(
>                         'conditions' => array(
>                         'Profile.id' => $auth_id))) );
>         $data = $this->find('first', $params);
>         return $data;
>
> }
>
> Relation:
> User model
>
> var $hasOne = array(
>         'Profile' => array(
>                 'className' => 'Profile',
>                 'foreignKey' => 'id',
>                 'dependent' => false
>                 )
>         );
>
> The Profile.id is the same as User.id
>
> Any ideas or help would be great.
>
> thanks
>
> Dave

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 
cake-php+at http://groups.google.com/group/cake-php?hl=en
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.716 / Virus Database: 270.14.102/2556 - Release Date: 12/13/09
04:09:00

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