我的模型中有以下代码。我希望展示个人和专业。但目前我的下面的代码不起作用,因为我刚添加一个加号来获得两者。我个人能够展示个人或专业人士。如何更改以下代码以显示个人和专业的所有结果?
function getAll($in_id){
$this->PassionsUser->id = $in_id;
return $this->PassionsUser->find('all', array(
'conditions' => array(
'PassionsUser.user_id' => $in_id,
'PassionsUser.type' => 'personal'
)
)); + $this->PassionsUser->id = $in_id;
return $this->PassionsUser->find('all', array(
'conditions' => array(
'PassionsUser.user_id' => $in_id,
'PassionsUser.type' => 'professional'
)
));
}
答案 0 :(得分:0)
这应该有效:
function getAll($id){
return $this->PassionsUser->find('all',
array(
'conditions' => array(
'PassionsUser.user_id' => $id,
'PassionsUser.type' => array('personal', 'professional')
)
)
);
}
否则,请参阅here
中的cake的OR功能