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:

SELECT `User`.`id`, `User`.`group_id`, `User`.`country_id`,
`User`.`unique`, `Group`.`id`, `Group`.`name`, `Group`.`created`,
`Group`.`modified`, `Country`.`id`, `Country`.`name`,
`Country`.`shortcode` FROM `users` AS `User` LEFT JOIN `groups` AS
`Group` ON `User`.`group_id` = `Group`.`id` LEFT JOIN `countries` AS
`Country` ON `User`.`country_id` = `Country`.`id` WHERE (`user_id2` =
'17') AND (`user_id1` = '16')

$this->User->read(null, $id); Does retrieve the information correctly
though. But because retrieving the HABTM information with "read" takes
3 queries I can't set conditions.

Thanks,
Arjen


--~--~---------~--~----~------------~-------~--~----~
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