Conditions | 5 |
Paths | 3 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function run() |
||
20 | { |
||
21 | $model = new $this->modelClass; |
||
22 | |||
23 | if (($ids = Yii::$app->request->post('selection')) !== null) { |
||
24 | $models = $model::findAll($ids); |
||
25 | $operation = Yii::$app->request->post('operation'); |
||
26 | |||
27 | if (isset($this->actions[$operation])) { |
||
28 | $attrubutes = $this->actions[$operation]; |
||
29 | foreach ($models as $model) { |
||
30 | switch ($operation) { |
||
31 | case 'delete': |
||
32 | $model->delete(); |
||
33 | break; |
||
34 | default: |
||
35 | $model->updateAttributes($attrubutes); |
||
36 | break; |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 | |||
42 | return $this->controller->asJson(true); |
||
|
|||
43 | } |
||
44 | } |
||
45 |
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: