I am trying to bind 3 models in cakephp.The relation is as follows
Member hasMany Member_Organaization Member_Organisations belongs to Organaization
i try to use
$this->Member->find('all',conditions)
it just show me only data upto hasMany association. I understand that the Member model is not related directly to the organization one. but how can we do it? My code is as follows:
$this->Member->bindModel(
array(
'hasMany'=>array(
'NpoMember' =>array(
'className' => 'NpoMember',
'foreignKey' => 'member_id',
'conditions' => array('NpoMember.status' => 'Active'),
)
)
)
);
$this->NpoMember->bindModel(
array(
'belongsTo'=>array(
'Npo'=>array(
'className' => 'Npo',
'foreignKey' => 'npo_id',
'conditions' => array('Npo.status' => 'Active')
)
)
)
);
$userData = $this->Member->find('first',array('conditions'=>array('Member.email'=>$userEmail,'Member.password'=>$passWord,'Member.status'=>'Active')));
I found this site to be very helpful. Thanks and Regards Himanshu Sharma