On Dec 12, 7:23 am, Mr-Yellow <[EMAIL PROTECTED]> wrote:
> Lets say I want.....
>
> Foo = 1
> AND
> Bar = '2'
> AND
> (Cat LIKE 'a%' OR Cat LIKE 'b%' OR Cat LIKE 'c%')
>
> Tried just about everything.....

I am pretty sure you didn't try:

$constraint['FooModel.FooField'] = 1;
$constraint['BarModel.BarField'] = 2;
$constraint['OR'] = array('Foo.Cat' => 'LIKE a%', array('Foo.Cat' =>
'LIKE b%'), array('Foo.Cat' => 'LIKE c%'));
$results = $this->FooModel->findAll($constraint);

Or something very similar.

> How can it be this hard???

How hard?

> Why are there so many users not able to get queries to work in so many
> situations? Does it mean the overall design of the query construtor is
> broken and unusable for most?

Who have you been talking to?

> Is there anywhere that shows a array layout for a decent query with
> mutliple conditions and depths of logic?

If you want a specific example, ask a specific question (here or on
the irc channel).

> All the examples I can find are very 2D and only include 1 table, and
> never 2 'AND' conditions on the same field unless using IN array.

The /only/ thing you need to be aware of, and in reality it is
obvious, is that if you write array('identicalKey' => x, 'identicalKey
=> y) you are overwriting the first definition with the second. See
first example for one way to avoid that.

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

Reply via email to