Hey-
I'm trying to generate a list of users who are not friends of the
currently logged in user.
I have two tables: profiles, and users_users
profiles includes the fields: id, first_name, last_name, etc...
users_users includes: id, user_id, friend_id

I can get the list of users who ARE friends:
$friends = $this->User->findAll('User.id=' . $target);

...but can't figure out how to go the other way???

My user model includes:
class User extends AppModel
{
        var $name = 'User';
        var $hasAndBelongsToMany = array(
                'Friends' => array(
                        'className' => 'Profile',
                        'joinTable' =>'users_users',
                        'foreignKey' =>'user_id',
                        'associationForeignKey' => 'friend_id',
                        'unique'=> true
                        ),
                'FriendList' => array(
                        'className' => 'users_users',
                        'joinTable' =>'users_users',
                        'foreignKey' =>'user_id',
                        'associationForeignKey' => 'friend_id',
                        'unique'=> true
                        )
        );
}

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