Ordered dropDownList using relations?

I have some forms in Yii using the following to get lists of data from related tables in the form of a drop down:

dropDownList(CHtml::listData(Company::model()->findAll(array('order' => 'company ASC'))));

This works, but that means for every drop down list (which theres a lot of) I'm putting this array('order' => 'company ASC' in every one.

Is this the best way to do it? Is there not a way to get this data using the model relations(), and specifying the order within the relation?

5
задан tshepang 17 November 2013 в 09:42
поделиться