Here are my models:
class Subject extends AppModel {
public $belongsTo = array('SubjectGroup');
}
class SubjectGroup extends AppModel {
public $hasMany = array('Subjects');
}
I am retrieving all SubjectGroups in my controller like this:
$this->SubjectGroup->find('all', array('order' => 'SubjectGroup.name'));
But how do I also tell it to order the Subjects within each SubjectGroup by Subject.name?
Solution:
Thanks to chetan patel for reminding me of the advanced options.
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasmany