Cake doesn't join the tables when the relation type is hasMany. Rather it performs a query on the first table (employees
) and with the id
of the employee it performs a second query on postings
table to retrieve all the postings related to that employee
you can manually join the tables but I suggest querying on postings table and then group by Employee
$this->Posting ->find(
'all',
array(
'fields' => array('Employee.id', 'Employee.name', 'Posting.status' ),
'conditions' => $cond,
'group' => array('Employee.id')
)
);