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