There doesn't appear to be any way to efficiently order a related model that is part of a one-to-many relationship.
Using the following code as my example set:
Model Posts (has many comments) Model Comments (belongs to posts)
$posts = Posts::find();
I understand the current options for ordering related models are:
- getRelated()
- getComments() (which will wrap getRelated() anyway)
Could related model ordering be passed as an array? Perhaps like this:
$posts = Posts::find(array(
'order' => 'date desc',
'comments' => array(
'order' => 'date desc'
)
));