I'm seeing some odd behavior when using Containable with conditions.

I have a model... lets call it 'DustParticle'.. it belongs to two
other models
DustParticle belongs to Broom
and
DustParticle belongs to OfficeDesk

anyhow.. try not to read too much into the dust concept.

When I run something like this:

$this->DustParticle->find(
                        'count',
                        array(
                                'conditions' => array(
                                        "DustParticle.user_id = $an_id"
                                        ),
                                'contain' => array(
                                        'OfficeDesk' => array(
                                                'conditions' => array(
                                                        "OfficeDesk.active = 
'yes'"
                                                        )
                                                )
                                        )
                                )
                        );

the resulting query is:

SELECT COUNT(*) AS `count` FROM `dust_particles` AS `DustParticle`
LEFT JOIN `office_desks` AS `OfficeDesk` ON
(`DustParticle`.`office_desk_id` = `OfficeDesk`.`id` AND
`OfficeDesk`.`active` = 'yes') WHERE `DustParticle`.`user_id` = '3'


the problem being that it put that extra condition (OfficeDesk.active
= yes) into the JOIN..ON statement.

my question is, i suppose, is this a known problem? or should I submit
a ticket? or perhaps i'm just using containable incorrectly?

it only seems to occur (so far) when I have a Model that belongs to 2
other models. I have a couple other queries that use containable
conditions.. but they are hasMany relationships and this problem
doesn't show up.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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