See the following example.

http://pastie.org/private/l9gabbwtk7m6jdqtv1cq

This is a very basic example, it requires that the table for "profiles"
contains the field 'user_id int (or mediumint).

For more info on relationships go here

http://book.cakephp.org/view/78/Associations-Linking-Models-Together

Hope this helps

On 1 December 2010 20:34, Carachi <[email protected]> wrote:

> Hi Jeremy,
> I have the same problem of bobaso
> But I don't understand How can I do to solve the problem.
>
> How I can edit my model to do it?
>
> Thank you
>
> On Nov 17, 8:31 pm, Jeremy Burns | Class Outfit
> <[email protected]> wrote:
> > The syntax you are using relates to models, not to controllers. So within
> the users_controller you can do:
> >
> > $result = $this->User->Profile->find(...);
> >
> > ...so long as the Profile model is related to the User model.
> >
> > If you want to do the same but from within the User model, you'd do this:
> >
> > $result = $this->Profile->find(...);
> >
> > Jeremy Burns
> > Class Outfit
> >
> > [email protected]http://www.classoutfit.com
> >
> > On 17 Nov 2010, at 10:20,bobasowrote:
> >
> >
> >
> >
> >
> >
> >
> > > I'm having some troubles with PHP while working with Controllers.
> > > If i want to create and then use 2 controllers,when using this syntax
> > > it doesn't work:
> >
> > > $this->Controller1->Controller2->find("all"...)
> >
> > > Instead this works:
> >
> > > $this->Controller1->find("all"...)
> >
> > > I was thinking that maybe i need to initialise first the Controller2
> > > in this way:
> >
> > > var $users="Controller2"
> >
> > > and then maybe the first syntax may work,but i'm not sure.Any advice?
> >
> > > Thank you in advance for your help =)
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://
> 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]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Kind Regards
 Stephen @ NinjaCoderMonkey

 www.ninjacodermonkey.co.uk

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