It seems to me that your search needs to be on User because that's the
table that has a "name" column. And any Friend will already be
associated with a User, anyhow.
What is the ultimate goal? Are trying to find Friends of this User
whose name is "Tom". You should be able to do something like:
$this->User->find(
'all',
array(
'conditions' => array(
'User.name' => $q
),
'contain' => array('Friend')
)
);
That will fetch all Users whose name = $q, along with their associated
Friend data. Are you looking to narrow that down to just Friends of
this User? If so, you'll need to explain how your models are
associated.
On Wed, Apr 22, 2009 at 2:17 PM, Chez17 <[email protected]> wrote:
>
> Stu,
>
> I am trying to search over both Models and paginate the results. So I
> can't just do what you suggested. It needs to be one query. I have
> started working with joins but it's still not working.
>
> 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
-~----------~----~----~----~------~----~------~--~---