Conditions | 3 |
Paths | 4 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function search($params) |
||
38 | { |
||
39 | /* @var $query \yii\db\ActiveQuery */ |
||
40 | $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User'; |
||
|
|||
41 | $query = $class::find(); |
||
42 | |||
43 | $dataProvider = new ActiveDataProvider([ |
||
44 | 'query' => $query, |
||
45 | ]); |
||
46 | |||
47 | $this->load($params); |
||
48 | if (!$this->validate()) { |
||
49 | $query->where('1=0'); |
||
50 | return $dataProvider; |
||
51 | } |
||
52 | |||
53 | $query->andFilterWhere([ |
||
54 | 'id' => $this->id, |
||
55 | 'status' => $this->status, |
||
56 | ]); |
||
57 | |||
58 | $query->andFilterWhere(['like', 'username', $this->username]) |
||
59 | ->andFilterWhere(['like', 'email', $this->email]); |
||
60 | |||
61 | return $dataProvider; |
||
62 | } |
||
63 | } |
||
64 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: