bump (my first and last)

I'll probably be opening a ticket for this one - although I can work
around it (phew) it just doesn't seem to be working as expected or
specified in the manual.

On Nov 20, 12:26 pm, morris <[EMAIL PROTECTED]> wrote:
> Thanks for the quick response on that!
>
> Yeah, I know that moving the condition to the main condition area will
> work, but it still doesn't resolve why the containable behavior (in my
> mind) isn't functioning as one would expect. Conditions within Contain
> work in other situations, why not here? Even the manual specifies that
> using find params in 'Contain' is the way to do it.
>
> array-based conditions.. didn't make a difference in this scenario,
> but thanks for pointing it out.
>
> On Nov 20, 12:15 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
>
> > Move the OfficeDesk condition to the main condition.
>
> > Also, use array-based condition:
> > array(
> >    'Model.field' => 'value'
> > )
>
> > On Thu, Nov 20, 2008 at 3:08 PM, morris <[EMAIL PROTECTED]> wrote:
>
> > > 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.
>
> > --
> > Renan Gonçalves aka renan.saddam
> > Software Engineer - CakePHP Core Developer
> > Cell Phone: +55 11 8633 6018
> > MSN: [EMAIL PROTECTED]
> > São Paulo - SP/Brazil
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to