Экстеншн дополнен проверко параметра order, если массив - то нужно

склеить подготовленные данные через запятую, иначе брать значение из
_GET _POST
1 parent 2479e644
...@@ -54,7 +54,8 @@ class WRestListAction extends CAction ...@@ -54,7 +54,8 @@ class WRestListAction extends CAction
$c->limit = (int)(($limit = Yii::app()->request->getParam($this->limit)) ? $limit : -1); $c->limit = (int)(($limit = Yii::app()->request->getParam($this->limit)) ? $limit : -1);
$page = (int)Yii::app()->request->getParam($this->page) - 1; $page = (int)Yii::app()->request->getParam($this->page) - 1;
$c->offset = ($offset = $limit * $page) ? $offset : 0; $c->offset = ($offset = $limit * $page) ? $offset : 0;
$c->order = ($order = Yii::app()->request->getParam($this->order)) ? $order : $model->getMetaData()->tableSchema->primaryKey; $c->order = is_array($this->order) ? implode(", ", $this->order) :
(($order = Yii::app()->request->getParam($this->order)) ? $order : $model->getMetaData()->tableSchema->primaryKey);
$models = $model->findAll($c); $models = $model->findAll($c);
$result = array(); $result = array();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!