1 | <?php |
||
17 | class DashboardPanelController extends Controller |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * @inheritdoc |
||
22 | */ |
||
23 | public function behaviors() |
||
24 | { |
||
25 | if (!$updateRoles = Module::getInstance()->updateRoles) { |
||
26 | return []; |
||
27 | } |
||
28 | return [ |
||
29 | 'access' => [ |
||
30 | 'class' => AccessControl::className(), |
||
31 | 'rules' => [ |
||
32 | [ |
||
33 | 'allow' => true, |
||
34 | 'actions' => ['view'], |
||
35 | 'roles' => ['@'] |
||
36 | ], |
||
37 | [ |
||
38 | 'allow' => true, |
||
39 | 'actions' => ['index', 'create', 'update', 'delete'], |
||
40 | 'roles' => $updateRoles |
||
41 | ] |
||
42 | ] |
||
43 | ] |
||
44 | ]; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Creates a new DashboardPanel model. |
||
49 | * If creation is successful, the browser will be redirected to the 'view' page. |
||
50 | * @return mixed |
||
51 | */ |
||
52 | public function actionCreate() |
||
66 | |||
67 | /** |
||
68 | * Updates an existing DashboardPanel model. |
||
69 | * If update is successful, the browser will be redirected to the 'view' page. |
||
70 | * @param string $id |
||
71 | * @return mixed |
||
72 | */ |
||
73 | public function actionUpdate($id) |
||
89 | |||
90 | |||
91 | /** |
||
92 | * Deletes an existing DashboardPanel model. |
||
93 | * If deletion is successful, the browser will be redirected to the 'index' page. |
||
94 | * @param string $id |
||
95 | * @return mixed |
||
96 | */ |
||
97 | public function actionDelete($id) |
||
105 | |||
106 | /** |
||
107 | * Finds the DashboardPanel model based on its primary key value. |
||
108 | * If the model is not found, a 404 HTTP exception will be thrown. |
||
109 | * If defined for panel allowRoles, check user access |
||
110 | * @param string $id |
||
111 | * @return DashboardPanel the loaded model |
||
112 | * @throws HttpException if the model cannot be found |
||
113 | */ |
||
114 | protected function findModel($id) |
||
127 | } |
||
128 |
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: