I have relations like this:
- Project has multiple Properties
- Property has multiple Rates
On the project page, I want to display:
- The project, its properties and its latest rate
So far, I have this:
$this->set('rates', $this->Rate->find('all', array(
'conditions' => array('Property.project_id' => $id),
'fields' => array('Rate.id', 'Rate.rate', 'Rate.floor_rise', 'Property.id'),
'order' => array('Rate.created DESC')
)));
This gives all rates for the respective property, but I only want the latest rate.
How should I do this query?
)));