我在cake php查询构建器中遇到OR条件问题。这将返回0结果。
$results = $this->paginate('Did', array('Did.ivr_id LIKE ' => $number . "%",'OR'=>array('Did.did LIKE ' => $number . "%")));
$result = $this->paginate = array(array('Did.did LIKE' => $number . "%"));
$this->set('dids', $results);
当我在简单列上应用条件时,它会给出准确的结果
$results = $this->paginate('Did', array('Did.ivr_id LIKE' => $number . "%"));
$result = $this->paginate = array(array('Did.did LIKE' => $number . "%"));
$this->set('dids', $results);
答案 0 :(得分:1)
您需要在OR数组中放置您想要的所有条件。
$results = $this->paginate(
'Did',
array(
'OR'=>array(
'Did.ivr_id LIKE ' => $number . "%",
'Did.did LIKE ' => $number . "%"
)
)
);