Model: Complicated ORDER BY

Hey folks,

I have this query:


$cities = City::model()->with('confirmedCount', 'unconfirmedCount')->findAll();

Both ‘confirmedCount’ and ‘unconfirmedCount’ are stat relationships.

How can I sort by confirmedCount?

My experimenting so far made me think this is not possible?

Thanks in advance!

in relation confirmedCount in array of model relations you have to add eg ‘order’=>‘confirmedCount.id ASC’

But I don’t always want to do that with every query for confirmedCount.

I have one query that fetches the confirmedCount for each city, and now I want to order the cities by their confirmedCount.