Skip to main content

Posts

Showing posts with the label Cakephp Find conditions

CakePHP Complex Find Conditions

Today we are going to discuss over complex find conditions using multiple 'AND' and 'OR' operators.   I was to write a CakePHP find condition for following query : Select * from Quarter where Quarter.status = 1 AND ((Quarter.start_date >= '2012-04-01' AND Quarter.end_date <= '2012-06-30') OR (Quarter.start_date >= '2012-07-01' AND Quarter.end_date <= '2012-09-30')) ; It's not that typical but typical enough to understand the concept. First I wrote this query : $conditions = array(                 'conditions' => array(                                 'AND' => array(                         ...