Or you can create a separate model (eg. Relation) instead of using HABTM,
where:

Relation belongsTo User1 (User model)
Relation belongsTo User2 (User model)
User1 hasMany Relation
User2 hasMany Relation

2008/11/1, Novice Programmer <[EMAIL PROTECTED]>:
>
> yeah the same works for me as well..
>
> Thanks.
>
> On Sat, Nov 1, 2008 at 5:03 PM, schneimi <[EMAIL PROTECTED]>wrote:
>
>>
>> Hi,
>>
>> I set this up for users and friends with the following relation in the
>> user model:
>>
>>  var $hasAndBelongsToMany = array('Friend' =>
>>                                   array('className'   => 'User',
>>                                         'joinTable' =>
>> 'users_friends',
>>                                         'conditions'  => '',
>>                                         'order'       => '',
>>                                         'limit'       => '',
>>                                         'foreignKey'  => 'user_id',
>>                                         'associationForeignKey' =>
>> 'friend_id',
>>                                         'dependent'   => true,
>>                                         'exclusive'   => false,
>>                                         'finderQuery' => '',
>>                                         'deleteQuery'  => ''
>>                                   )
>>                             );
>>
>> Hope this helps,
>>
>> Michael
>>
>> [EMAIL PROTECTED] schrieb:
>> > I have a table of users, and I want to make links between users, so
>> > each user can have links to one or more other users. I can't see,
>> > however, how to set this up in Cake. The linking table has two fields
>> > that link to the Users table, but how to I create the correct model?
>>
>>
>
>
> --
> Thanks & Regards,
> Novice.
>
> >
>


-- 
Sincerely yours,
Olexandr Melnyk
http://omelnyk.net/

--~--~---------~--~----~------------~-------~--~----~
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