On Feb 20, 10:52 am, "Arjen" <[EMAIL PROTECTED]> wrote:
> Hi everybody,
>
> I'm trying to retrieve information from a HABTM directly. Users may
> have a relation between each other, the have a self joined HABTM with
> a table users_users.
> $conditions = array("user_id2" => $me, "user_id1"=>$id);
> $contacts = $this->User->User1->findAll($conditions);
> But the query above sees the Users1 not model as the HABTM relation
> but as the regular User model. And the following query is run:
Please clarify what you want to achieve.
$this->User->findAll(x), will be the same as $this->User->User1-
>findAll(x), will be the same as $this->User->User2->findAll(x) will
be the same as $this->AModelThatLinksTo->User->findAll(x).
Probably relavant:
http://groups.google.com/group/cake-php/search?group=cake-php&q=%22filtering+habtm%22&qt_g=Search+this+group
Note that you can set conditions on an association defenition, so you
can influence the constraint used in the 3 queries.
HTH,
AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---