在CakePHP 2.5.x中的二级关联上应用where条件
我想在cakephp中为我的二级关联添加一个where子句。在我看来,这应该是可行的,但它给了我一个错误 错误:[PDOException]SQLSTATE[42S22]:未找到列:“where子句”中的1054未知列“User.email_address”。 阅读更多:在CakePHP 2.5.x中的二级关联上应用where条件,cakephp,model-associations,cakephp-2.5,Cakephp,Model Associations,Cakephp 2.5,我想在cakephp中为我的二级关联添加一个where子句。在我看来,这应该是可行的,但它给了我一个错误 错误:[PDOException]SQLSTATE[42S22]:未找到列:“where子句”中的1054未知列“User.email_address”。 阅读更多: 它正在工作,但它给了我左连接的结果,就像它给了我用户不匹配的用户为null的结果一样。 $options = array( 'contain' => array( 'People',
它正在工作,但它给了我左连接的结果,就像它给了我用户不匹配的用户为null的结果一样。
$options = array(
'contain' => array(
'People',
'People' => array('User')
),
'conditions'=> array(
'User.email_address' => 'sample@mail.com'
),
'recursive' =>1,
);
$query = $this->Organization->find('all', $options);
$options = array(
'contain' => array(
'People' => array(
'User' => array(
'conditions'=> array(
'User.email_address' => 'sample@mail.com'
),
),
),
),
//'recursive' =>1,
);
$query = $this->Organization->find('all', $options);