I would probably do something like this, where I use a new model
"Friendship" as the join table.

eg.

friendships
--------------------
id
user_id
friend_user_id

You probably need to specify join fields and the like, and also you
might need to do a custom finderQuery to enable search both join
fields.

        var $hasAndBelongsToMany = array(
                'Friend' => array('className' => 'User', 'with' => 
'Friendship'),
        );

Maybe even look at noserub on how it handles social networks.

Cheers,
Adam

On Apr 9, 7:06 pm, dizz <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm trying to add a friend feature to one of my sites.
>
> I am trying to wrap my head around how to set up the relationship.
>
> I have a table users which holds all the users info.
>
> Each user can have many friends which is just an alias for many users
> and those friends (users) belong to the User.
>
> This sounds like a HABTM relation, but how would I go about setting it
> using the same model?
>
> Any help would be greatly appreciated.
>
> Thanks,
> -Andrew
--~--~---------~--~----~------------~-------~--~----~
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