/** * Applies additional dependencies special for sql search criteria. * * @return CDataProvider data provider * * @see SearchModel::fetch() */ public function fetch() { $dataProvider = parent::fetch(); if ($dataProvider instanceof CActiveDataProvider) { $criteria = $dataProvider->criteria; if (empty($criteria->order)) { $this->applySort($criteria); } } return $dataProvider; }