| @@ 120-142 (lines=23) @@ | ||
| 117 | * @param $params |
|
| 118 | * @return ActiveDataProvider |
|
| 119 | */ |
|
| 120 | public function search($params) |
|
| 121 | { |
|
| 122 | /* @var $query \yii\db\ActiveQuery */ |
|
| 123 | $query = self::find() |
|
| 124 | ->where(['parent_id'=>$this->parent_id]); |
|
| 125 | $dataProvider = new ActiveDataProvider( |
|
| 126 | [ |
|
| 127 | 'query' => $query, |
|
| 128 | 'pagination' => [ |
|
| 129 | 'pageSize' => 10, |
|
| 130 | ], |
|
| 131 | ] |
|
| 132 | ); |
|
| 133 | if (!($this->load($params))) { |
|
| 134 | return $dataProvider; |
|
| 135 | } |
|
| 136 | $query->andFilterWhere(['id' => $this->id]); |
|
| 137 | $query->andFilterWhere(['like', 'name', $this->name]); |
|
| 138 | $query->andFilterWhere(['like', 'route', $this->route]); |
|
| 139 | $query->andFilterWhere(['like', 'icon', $this->icon]); |
|
| 140 | $query->andFilterWhere(['like', 'added_by_ext', $this->added_by_ext]); |
|
| 141 | return $dataProvider; |
|
| 142 | } |
|
| 143 | ||
| 144 | /** |
|
| 145 | * Returns model instance by ID(primary key) with cache support |
|
| @@ 91-114 (lines=24) @@ | ||
| 88 | * @param $params |
|
| 89 | * @return ActiveDataProvider |
|
| 90 | */ |
|
| 91 | public function search($params) |
|
| 92 | { |
|
| 93 | /* @var $query \yii\db\ActiveQuery */ |
|
| 94 | $query = self::find(); |
|
| 95 | $dataProvider = new ActiveDataProvider( |
|
| 96 | [ |
|
| 97 | 'query' => $query, |
|
| 98 | 'pagination' => [ |
|
| 99 | 'pageSize' => 10, |
|
| 100 | ], |
|
| 101 | ] |
|
| 102 | ); |
|
| 103 | if (!($this->load($params))) { |
|
| 104 | return $dataProvider; |
|
| 105 | } |
|
| 106 | $query->andFilterWhere(['id' => $this->id]); |
|
| 107 | $query->andFilterWhere(['like', 'title', $this->title]); |
|
| 108 | $query->andFilterWhere(['like', 'slug', $this->slug]); |
|
| 109 | $query->andFilterWhere(['like', 'h1', $this->h1]); |
|
| 110 | $query->andFilterWhere(['like', 'meta_description', $this->meta_description]); |
|
| 111 | $query->andFilterWhere(['like', 'slug', $this->slug]); |
|
| 112 | ||
| 113 | return $dataProvider; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Returns active prefiltered page as array for specified URL (exact match). |
|