I am using Cakephp 2.10.0. While working with find condition, I am facing a strange issues LIKE "OR" condition convert automatically to "AND" e.g
I am making find condition like:
$this->{$this->leadCall}->find('list', array('conditions'=>array($this->leadCall.'.future_call !=' => date('m/d/Y'), 'or' => array($this->leadCall.'.future_call !=' => '')),'fields' => array('lead_id')));
It results
SELECT `LeadCall`.`id`, `LeadCall`.`lead_id` FROM `zindagihomes`.`lead_calls` AS `LeadCall` WHERE `LeadCall`.`future_call` != '11/19/2017' AND `LeadCall`.`future_call` != ''
And I want query something like this
SELECT `LeadCall`.`id`, `LeadCall`.`lead_id` FROM `zindagihomes`.`lead_calls` AS `LeadCall` WHERE `LeadCall`.`future_call` != '11/19/2017' OR `LeadCall`.`future_call` != ''
I got my mistake. It was due wrong array formation.
<pre>
$conditions = array(
'OR' => array(
$this->leadCall.'.future_call !=' => date('m/d/Y'),
$this->leadCall.'.future_call !=' => ''
)
);
$futureCall = $this->{$this->leadCall}->find('list', array('conditions'=>$conditions,'fields' => array('lead_id')));
</pre>
it is working fine as expected.