I think I follow what you are trying to do, here is my solution..
User hasMany Friends
Friend belongsTo User
So you would want something like this:
=======
# do the normal User stuff here
$conditions = array('User.name' => 'Tom');
# find IDs of friends here
$friends = $this->User->Friend->find('list', array('conditions' =>
array('Friend.name' => 'Tom')));
# merge conditions
$conditions = Set::merge($conditions, array('User.id' => $friends));
$this->User->find('all', array('conditions' => $conditions));
=======
The $friends array would contain a bunch of IDs, and the User->find()
operation would know to add WHERE User.id IN (<your $friends IDs
here>);
HTH
-Adam D
On Apr 22, 2:10 pm, Stu <[email protected]> wrote:
> What code are you trying right now?
>
> Seems like you're trying to find data based on an unknown column
>
> Usually for hasMany searches I would do this:
>
> $this->User->friend->find('foo', $options);
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---