Great tip if your working with the PHP-framework Yii, if you create a new model and want to set some default values, like ”order by”, you can just add the following function (defaultScope) to your CActiveRecord extended class:
public function defaultScope(){
return array(
‘order’=>’my_order_field DESC’
);
}
Read more here: http://www.yiiframework.com/doc/guide/1.1/en/database.ar