"My OR is an AND??"

Conditional Joins:
====================================================
$cuisine = $this->data['Restaurant']['c'];
                        $results = $this->Restaurant->find('first', 
array('joins' => array(
                                        array(
                                                        #'table' => 
'markers_tags',
                                                        'table' => 
'cuisines_restaurants',
                                                        'alias' => 
'CuisinesRestaurant',
                                                        'type' => 'inner',
                                                        'foreignKey' => false,
                                                        'conditions'=> 
array('CuisinesRestaurant.restaurant_id =
Restaurant.id')
                                                )
                                   ,array(
                                                        'table' => 'cuisines',
                                                        'alias' => 'Cuisine',
                                                        'type' => 'inner',
                                                        'foreignKey' => false,
                                                        'conditions'=> array(
                                                                
'CuisinesRestaurant.cuisine_id = Cuisine.id',
                                                                
array('Cuisine.name LIKE ' => "%Thai%"), 'or' => array
('Cuisine.name LIKE ' => "%American%")

                                                )
                                        )
                                )));
                        $this->set('results',$results);
====================================================

SQL Result:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT `Restaurant`.`id`, `Restaurant`.`name`, `Restaurant`.`tagline`,
`Restaurant`.`description`, `Restaurant`.`keywords`,
`Restaurant`.`address`, `Restaurant`.`city`, `Restaurant`.`state`,
`Restaurant`.`zip`, `Restaurant`.`phone`,
`Restaurant`.`hours_of_service`, `Restaurant`.`website`,
`Restaurant`.`active`, `Restaurant`.`date_created` FROM `restaurants`
AS `Restaurant` inner JOIN cuisines_restaurants AS
`CuisinesRestaurant` ON (`CuisinesRestaurant`.`restaurant_id` =
`Restaurant`.`id`) inner JOIN cuisines AS `Cuisine` ON
(`CuisinesRestaurant`.`cuisine_id` = `Cuisine`.`id` AND
`Cuisine`.`name` LIKE '%Thai%' AND `Cuisine`.`name` LIKE '%American%')
WHERE 1 = 1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Why??

--

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=.


Reply via email to