How can i set the default order for a CModel. so when i use the data in a CHtml::listData() i dont need a criteria in the findAll()
CHtml::listData(Category::model()->findAll(), 'IdCategory', 'Category')
How can i set the default order for a CModel. so when i use the data in a CHtml::listData() i dont need a criteria in the findAll()
CHtml::listData(Category::model()->findAll(), 'IdCategory', 'Category')
Use named scopes.
This did the trick!
public function defaultScope() {
return array('order' => 'IdCategory ASC');
}