Ha, I finally figured it out, so in case it helps anyone - the
following:
$findParams = array(
'or' => array(
'MyItem.parent_content_item_id' => $myId,
'MyParentItem.id' => $anotherId,
'MyParentItem.id' => $yetAnotherId
));
only works when re-written as:
$findParams = array(
'or' => array(
'MyItem.parent_content_item_id' => $myId,
'MyParentItem.id' => array($anotherId,
$yetAnotherId)
));
Possibly obvious, I didn't know that though!
Toby
toby1kenobi wrote:
> Anyone got any clues on e, I feel like I'm overlooking some daft
> error?
>
> toby1kenobi wrote:
> > Thanks for the quick response! I was just about to follow up that post
> > and say that it's almost working, but not quite (and maybe the error
> > is mine).
> >
> > Here's (a slightly simplified version of) my code:
> >
> > $findParams = array(
> > 'or' => array(
> > 'MyItem.parent_content_item_id' => $myId,
> > 'MyParentItem.id' => $anotherId,
> > 'MyParentItem.id' => $yetAnotherId
> > ));
> >
> > $myItems = $this->paginate(null, $findParams);
> >
> > This is returning results that satisfy the first and third 'or'
> > conditions, but not the second one ('MyParentItem.id' => $anotherId).
> > Am I missing something daft?
> >
> > Toby
> >
> > On May 18, 4:28 pm, AD7six <[email protected]> wrote:
> > > On May 18, 5:26 pm, toby1kenobi <[email protected]> wrote:
> > >
> > > > Hi all,
> > >
> > > > Is it possible use 'or' in the conditions resulting from a call to
> > > > paginate?
> > >
> > > resulting? How are you getting paginate to give you conditions.
> > >
> > > >I have tried a whole load of variations (based on conditions
> > > > that work in a call to find('all'), but to no avail.
> > >
> > > like what.
> > >
> > > AD
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---