Christopher:

I understand the basics behind Cake“s HATBM, but I do not understand
how to implement here... You have to notice that "Friends" are also
"Users", so I dont know how to build the tables. Should I put the same
id in both tables? If not, what is the primary key in the "Friends"
table?
This case is typical in a CMS, where you want to let the user make
"friends" in the community. Anybody who has solved this particular
problem?

Thanks.



On Nov 12, 7:43 pm, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> Yes, this is a HABTM relationship both ways between friends and
> users.  Define the $hasAndBelongsToMany variable at the top of each
> model appropriately and then make an extra db table named:
> friends_users and within the table, you will have two fields,
> friend_id and user_id.
>
> After you have a few users and friends, if you want to see a user's
> friend of a friend of a friend, you use, the recursive option for the
> model:
> eg-
> $this->User->recursive = 1;
>
> The higher you go, the more levels deep will get returned
>
> On Nov 12, 2:20 pm, mbavio <[EMAIL PROTECTED]> wrote:
>
> > I have a 'User' model, and I want that my Users can have Friends,
> > being Friends other Users. Is this a "self HATBM"? How can I solve
> > this problem?
>
> > Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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