order

// AR Order by public function order($order = '') { $this->_order = (string)Yii::app()->request->getParam('order'); if($order == '') $order = $this->_order; if(!$order) return $this; // Если -$order то $desc = true; if($order[0] == '-') $desc = true; $order = preg_replace('~[^a-z]~', '', $order); $this->getDbCriteria()->mergeWith( array( 'order' => $order . (isset($desc) ? ' DESC ' : ''), ) ); return $this; }