| Conditions | 2 |
| Paths | 2 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public function search(array $params, int $pageSize = 10): ActiveDataProvider |
||
| 35 | { |
||
| 36 | $query = UserModel::find(); |
||
| 37 | |||
| 38 | $dataProvider = new ActiveDataProvider([ |
||
| 39 | 'query' => $query, |
||
| 40 | 'pagination' => [ |
||
| 41 | 'pageSize' => $pageSize, |
||
| 42 | ], |
||
| 43 | 'sort' => [ |
||
| 44 | 'defaultOrder' => ['id' => SORT_DESC], |
||
| 45 | ], |
||
| 46 | ]); |
||
| 47 | |||
| 48 | $this->load($params); |
||
| 49 | |||
| 50 | if (!$this->validate()) { |
||
| 51 | return $dataProvider; |
||
| 52 | } |
||
| 53 | |||
| 54 | $query->andFilterWhere([ |
||
| 55 | 'id' => $this->id, |
||
| 56 | 'status' => $this->status, |
||
| 57 | ]); |
||
| 58 | |||
| 59 | $query->andFilterWhere(['like', 'username', $this->username]) |
||
| 60 | ->andFilterWhere(['like', 'email', $this->email]); |
||
| 61 | |||
| 62 | return $dataProvider; |
||
| 63 | } |
||
| 64 | } |
||
| 65 |