我有一个模型:如何为模型的所有搜索操作设置默认条件?
class Service extends CActiveRecord
{
public static function model($className = __CLASS__)
{
return parent::model($className);
}
public static function getMainPageItems()
{
return self::model()->findAll(array(
'condition' => 'on_main = 1',
'order' => 'pos ASC'
));
public static function getNonMainPageItems()
{
return self::model()->findAll(array(
'condition' => 'on_main = 0',
'order' => 'pos ASC'
));
}
我要到模型的默认顺序设置为pos ASC
。
如何设置模型的默认订单?
这对我来说是正确的。谢谢! – Ozerich