如何在此代码中插入关于模型“为什么”的where子句。
我必须按表格的特定class_id
过滤(在蛋糕模型'为什么')。
你应该知道Pilot有很多为什么。
感谢帮助
$allplants = $this->Plant->find('all',[
'contain'=>array('Pilot'=>array(
'Lever',
'Area',
'Why',
'conditions'=> array('published' => 1, $conditions,"OR"=>$or_conditions))),
'conditions' => $plantConditions]
);
尝试一次,我实现的类似代码在cakephp3中工作。
$allplants= $this->Plant->find('all')->contain(['Pilot', 'Lever', 'Area'])
->innerJoinWith('Pilot.Why', function ($q) {
return $q->where($WhyConditions);
})
->conditions($plantConditions);