里面如何使用条件包含cakephp?

时间:2018-07-10 09:04:19

标签: php cakephp-1.3

我如何使里面包含cakephp?

这是我的代码:

$survey['Survey.soc_med'] = 'Facebook';
$conditions['Customer.membershipno !='] = '';

$this->loadModel('Customer');
$this->Customer->bindModel(array(
    'hasOne' => array(
        'Survey' =>array(
             'foreignKey'=>'customer_id',
             'conditions' =>$survey
))));

$this->Customer->Behaviors->attach('Containable');
$this->Customer->contain(array('Survey'));
$result=$this->Customer->find('all',array('conditions'=>$conditions));

我得到的结果是列出所有客户,好像绕过了bindmodel。有帮助吗?

0 个答案:

没有答案