Hello,
Guided by the book, I've created an association which lets users
choose friends from amongst the other users. It looks something like
this:
class User extends Model
{
var $hasAndBelongsToMany = array
(
'Users' => array
(
'className' => 'Users',
'joinTable' => 'users_has_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'user_friend_id'
)
);
}
When executing a find('count') to see if a user has someone as a
friend the manual says I should do the following:
$this->User->id = $this->Auth->user('id');
$this->User->Users->find('count', array('conditions'=>array
('Users.id'=> $friend_id))));
However, my result is '1' regardless of wether the jointable actually
joins User to Users. It seems to get completely ignored and just
return a find('count') on the users.
All the naming is correct through useTable. I am getting no errors
regarding naming.
Any clues as to what I am missing?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---