Saturday, November 1, 2008

Re: How to manage HABTM that is reflexive?

yeah the same works for me as well..

Thanks.

On Sat, Nov 1, 2008 at 5:03 PM, schneimi <michael.schneidt@arcor.de> 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

stratford.graham@gmail.com 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.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: