1 | <?php |
||
13 | class NewsController extends \yii\web\Controller |
||
14 | { |
||
15 | use ModelTrait; |
||
16 | |||
17 | 4 | public function behaviors() |
|
34 | |||
35 | 4 | public function actions() |
|
36 | { |
||
37 | return [ |
||
38 | 4 | 'operations' => [ |
|
39 | 4 | 'class' => 'app\modules\admin\controllers\common\OperationsAction', |
|
40 | 'modelClass' => News::class, |
||
41 | 'operations' => [ |
||
42 | 'delete' => [], |
||
43 | 4 | 'set-publish' => ['status' => News::STATUS_ACTIVE], |
|
44 | 4 | 'set-unpublish' => ['status' => News::STATUS_BLOCKED] |
|
45 | ] |
||
46 | ], |
||
47 | 'set-publish' => [ |
||
48 | 4 | 'class' => 'app\modules\admin\controllers\common\UpdateAttributesAction', |
|
49 | 'modelClass' => News::class, |
||
50 | 4 | 'attributes' => ['status' => News::STATUS_ACTIVE], |
|
51 | ], |
||
52 | 'set-unpublish' => [ |
||
53 | 4 | 'class' => 'app\modules\admin\controllers\common\UpdateAttributesAction', |
|
54 | 'modelClass' => News::class, |
||
55 | 4 | 'attributes' => ['status' => News::STATUS_BLOCKED], |
|
56 | ], |
||
57 | 'delete' => [ |
||
58 | 'class' => 'app\modules\admin\controllers\common\DeleteAction', |
||
59 | 'modelClass' => News::class, |
||
60 | ], |
||
61 | 'text-upload' => [ |
||
62 | 'class' => 'rkit\filemanager\actions\UploadAction', |
||
63 | 'modelClass' => News::class, |
||
64 | 'attribute' => 'text', |
||
65 | 'inputName' => 'file', |
||
66 | 'resultFieldPath' => 'filelink', |
||
67 | ], |
||
68 | 'preview-upload' => [ |
||
69 | 'class' => 'rkit\filemanager\actions\UploadAction', |
||
70 | 'modelClass' => News::class, |
||
71 | 'attribute' => 'preview', |
||
72 | 'inputName' => 'file', |
||
73 | ], |
||
74 | 'gallery-upload' => [ |
||
75 | 'class' => 'rkit\filemanager\actions\UploadAction', |
||
76 | 'modelClass' => News::class, |
||
77 | 'attribute' => 'gallery', |
||
78 | 'inputName' => 'file', |
||
79 | ], |
||
80 | ]; |
||
81 | } |
||
82 | |||
83 | 4 | public function actionIndex() |
|
95 | |||
96 | 3 | public function actionEdit($id = null) |
|
126 | } |
||
127 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.