|
@ -9,13 +9,12 @@ use common\models\Category; |
|
|
/** |
|
|
/** |
|
|
* CategorySearch represents the model behind the search form of `\common\models\Category`. |
|
|
* CategorySearch represents the model behind the search form of `\common\models\Category`. |
|
|
*/ |
|
|
*/ |
|
|
class CategorySearch extends Category |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
class CategorySearch extends Category { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* {@inheritdoc} |
|
|
* {@inheritdoc} |
|
|
*/ |
|
|
*/ |
|
|
public function rules() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public function rules() { |
|
|
return [ |
|
|
return [ |
|
|
[['id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'], |
|
|
[['id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'], |
|
|
[['cat_name', 'icon', 'description'], 'safe'], |
|
|
[['cat_name', 'icon', 'description'], 'safe'], |
|
@ -25,8 +24,7 @@ class CategorySearch extends Category |
|
|
/** |
|
|
/** |
|
|
* {@inheritdoc} |
|
|
* {@inheritdoc} |
|
|
*/ |
|
|
*/ |
|
|
public function scenarios() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public function scenarios() { |
|
|
// bypass scenarios() implementation in the parent class
|
|
|
// bypass scenarios() implementation in the parent class
|
|
|
return Model::scenarios(); |
|
|
return Model::scenarios(); |
|
|
} |
|
|
} |
|
@ -38,14 +36,21 @@ class CategorySearch extends Category |
|
|
* |
|
|
* |
|
|
* @return ActiveDataProvider |
|
|
* @return ActiveDataProvider |
|
|
*/ |
|
|
*/ |
|
|
public function search($params) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public function search($params) { |
|
|
$query = Category::find(); |
|
|
$query = Category::find(); |
|
|
|
|
|
|
|
|
// add conditions that should always apply here
|
|
|
// add conditions that should always apply here
|
|
|
|
|
|
|
|
|
$dataProvider = new ActiveDataProvider([ |
|
|
$dataProvider = new ActiveDataProvider([ |
|
|
'query' => $query, |
|
|
'query' => $query, |
|
|
|
|
|
'pagination' => [ |
|
|
|
|
|
'pageSizeLimit' => [1, 200] |
|
|
|
|
|
], |
|
|
|
|
|
'sort' => [ |
|
|
|
|
|
'defaultOrder' => [ |
|
|
|
|
|
'id' => SORT_DESC, |
|
|
|
|
|
] |
|
|
|
|
|
], |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
$this->load($params); |
|
|
$this->load($params); |
|
@ -71,4 +76,5 @@ class CategorySearch extends Category |
|
|
|
|
|
|
|
|
return $dataProvider; |
|
|
return $dataProvider; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |