Sunday, November 22, 2009

Re: Contain Question

My User.id is my Profile.id. When a user is created thier profile is
created same time and a UUID for the User is used for the Profile.id.
The models are related using Profile.id and User.id

Seemed pointless to have Profile.user_id = 1234-5678-910 and
Profile.id 1234-5678-910 since they are the same

Thanks, any other ideas?

On Nov 22, 8:16 am, gaga <megag...@gmail.com> wrote:
> Where you set Profile fields include 'Profile.user_id'.
>
> On Nov 21, 5:47 am, Dave <make.cake.b...@gmail.com> wrote:
>
> > Wondering why when I specify fields in this contain for User I cant
> > get and of the related Profile fields?
>
> > If i remove 'fields' from the User it pulls all User fields and then I
> > get my Profile fields but I dont want all my User fields, just the few
> > i need. What am I doing wrong here?
>
> > public function getUser($auth_id)
> >         //this fetches basic info for the profile view/index
> >         {
> >                 $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(
> >                                         'fields' => array(
> >                                                 'Profile.id',
> >                                                 'Profile.email'))));
>
> >                 $q = $this->find('first', $params);
> >               return $q;
> >         }
>
>

--

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cake-php?hl=.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate