Hi Dave,

- have  you made sure that your User model has
   var $actsAs = array('Containable'); in its class?
- are you setting 'recursive' to a value lower than 1 as a default for
your User model? (it will only work with a recursive value >= 1)
- Have you set your related fields in your Profile table  (i.e
user_id)
- Have you defined your relationships correctly in your User and
Profile models?

cheers



On Dec 14, 6:29 am, John Andersen <[email protected]> wrote:
> 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

Reply via email to