我想在cakephp中为我的第二级关联添加一个where子句。根据我的理解,这应该有效,但它给了我一个错误
$options = array(
'contain' => array(
'People',
'People' => array('User')
),
'conditions'=> array(
'User.email_address' => 'sample@mail.com'
),
'recursive' =>1,
);
$query = $this->Organization->find('all', $options);
答案 0 :(得分:2)
$options = array(
'contain' => array(
'People' => array(
'User' => array(
'conditions'=> array(
'User.email_address' => 'sample@mail.com'
),
),
),
),
//'recursive' =>1,
);
$query = $this->Organization->find('all', $options);
了解更多: