I have a join in cakephp as below:
$emp = $this->EmployeePersonal ->find(
'all',
array(
'fields' => array('EmployeePersonal.*', 'PermanentDist.name','PresentDist.name','EmployeePosting.*','Designation.name','Department.name','Office.name' ),
'conditions' => $condition,
'order' => array('Designation.id'),
'recursive' => -1,
'joins' => array(
array(
.................
.................
),
array(
'table' => 'employee_postings',
'alias' => 'EmployeePosting',
'type' => 'LEFT',
'order' => 'EmployeePosting.posting_from DESC',
'limit' => 1,
'conditions' => array(
'EmployeePosting.employee_personal_id = EmployeePersonal.id',
)
),
)
)
);
But the lines
'order' => 'EmployeePosting.posting_from DESC',
'limit' => 1,
are not working ! That means though I was expecting to get last newest posting_from
value, I am getting all the values ! Where I am doing wrong ? I think I have written the order
limit
in wrong place.