HOW to Sort Related objet

Hi, I have two tables related with HAS_MANY

public function relations() {

	return array(

		'cuotas' => array(self::HAS_MANY, 'Cuota', 'liquidacion_id'),



When I use $model->cuotas , I get all "cuota" object as usual.

My question is that I need to SORT, that info.

Is there any way to do that ?

Best Regards

'cuotas' => array(self::HAS_MANY, 'Cuota', 'liquidacion_id', 'order' => 'cuotas.columnNameToSort'),

Another option is to pass an array that contains criteria related keys to your relation. This gets merged to the query that gets generated from your relation. Example:

$sortedObjects = $model->cuotas(array(

	'order' => 'cuotas.columnNameToSort',