Hi,
I am trying to do a find with conditions in two models. Is this possible ?
$offices = $this->User->Org->find('first', array(
'conditions' => array(
"or" => array(
'Org.website LIKE' => $match,
'Domain.domain' => $match
)
)
));
The relationship looks like this
'Domain' => array(
'className' => 'Domain',
'foreignKey' => 'org_id',
),
As a containable search
$this->User->Org->Behaviors->attach('Containable');
$offices = $this->User->Org->find('first', array(
'contain' => array(
'Domain' => array(
'conditions' => array(
'Or' => array(
'Domain.domain' => $match
)
)
),
'Office' => array(
'fields' => array('Office.id', 'Office.city')
)
),
'conditions' => array(
"or" => array(
'Org.website' => $match
)
)
));
Thanks
Alex