I'm trying to search for profiles based on communities that they
HABTM.  I need to use an array for the search, because I'll be
including dozens of other criteria in the search.  I've got everything
else hammered out except how to search this way using HABTM assoc's.

I've tried tons of combos of binding models, etc to try to get what
I'm looking for, but I can't seem to get it right.  Here's the code
I'm using to try to test just this one aspect of the array search:

        function test()
        {
                $search = array();
                $search['Community.title'] = "Wally's Home Community";
                $this->Profile->bindModel(array('hasMany' =>
array('CommunitiesProfile' => array('foreignKey' => 'profile_id'))));
                $this->Profile->bindModel(array('hasOne' => array('Community' =>
array('foreignKey' => 'CommunitiesProfile.profile_id'))));
                debug($this->Profile->findAll($search));
                debug($this->Profile->findCount($search));
                exit;
        }

This particular incarnation of the code yields: Unknown column
'Community.CommunitiesProfile.profile_id' in 'on clause' for the
findAll call, and Unknown column 'Community.title' in 'where clause'
for the findCount call.

Can anyone please help steer me in the right direction?  How should I
structure the search array, and how do I bind these models to get the
results I'm looking for?

On IRC people kept telling me to debug() and pr() the results... This
doesn't help me figure out how to structure this type of query (though
I have tried $search['Profile']['Community']['title'] = 'title', which
is what the structure would have led me to believe was the way to go).

Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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