Then it's really only about extra parenthesis ?
What difference does it make ?

++++++
Clément

2008/8/21 XuMiX <[EMAIL PROTECTED]>:
>
> this is what I expect
>
> SELECT ...... WHERE `enabled` = 1 AND
> ((`controller` = 'media' AND `action` = 'index')
> OR (`controller` = 'media' AND `action` = '')
> OR (`controller` = '' AND `action` = '')) ORDER BY `order`
> ASC
>
> On 21 авг, 17:37, clemos <[EMAIL PROTECTED]> wrote:
>> Hi
>>
>> There is no bug, you have:
>> $conditions = array(
>>   "enabled"=>1,
>>   "or"=>array(
>>      array("controller"=>"whatever1","action"=>"stuff1"),
>>      array("controller"=>"whatever2","action"=>"stuff2"),
>>      ....
>>    )
>> )
>>
>> So :
>> 1. controller = "whatever*" and action="stuff*" are associed by and
>> "AND" (default operator)
>> 2. all these controller=* AND action=* are put together with operator
>> "OR" (because it's the key)
>> 3. you add "AND enabled=1" to the whole generated condition, because
>> AND is the default operator
>>
>> What did you expect ?
>> Something like that:
>>  SELECT ...... WHERE `enabled` = 1 OR ((((`controller` = 'media') AND
>> (`action` = 'index'))) AND (((`controller` = 'media') AND (`action` =
>> ''))) AND (((`controller` = '') AND (`action` = '')))) ORDER BY `order`
>> ASC
>> ???
>>
>> ++++++
>> Clément
>>
>>
>>
>> On Thu, Aug 21, 2008 at 10:53 AM, XuMiX <[EMAIL PROTECTED]> wrote:
>>
>> > I have a call
>> >            $conditions = array();
>> >            $conditions[] = array('controller' => $this-
>> >>params['controller'], 'action' => $this->params['action']);
>> >            $conditions[] = array('controller' => $this-
>> >>params['controller'], 'action' => '');
>> >            $conditions[] = array('controller' => '', 'action' => '');
>>
>> >            $this->blocksData = $model->find('all', array('order' =>
>> > 'order ASC',
>> >                                                          'conditions'
>> > => array('enabled' => '1',
>>
>> > array('or' => $conditions))));
>>
>> > here's what i get after call
>>
>> >  SELECT ...... WHERE `enabled` = 1 AND ((((`controller` = 'media') AND
>> > (`action` = 'index'))) OR (((`controller` = 'media') AND (`action` =
>> > ''))) OR (((`controller` = '') AND (`action` = '')))) ORDER BY `order`
>> > ASC
>>
>> > Is this a bug or my mistake?
> >
>

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