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 at
http://groups.google.com/group/cake-php?hl=en