1 | <?php |
||
27 | class RuleController extends Controller |
||
28 | { |
||
29 | use AuthManagerAwareTrait; |
||
30 | use ContainerAwareTrait; |
||
31 | |||
32 | /** |
||
33 | * @inheritdoc |
||
34 | */ |
||
35 | public function behaviors() |
||
36 | { |
||
37 | return [ |
||
38 | 'verbs' => [ |
||
39 | 'class' => VerbFilter::class, |
||
40 | 'actions' => [ |
||
41 | 'delete' => ['POST'], |
||
42 | ], |
||
43 | ], |
||
44 | 'access' => [ |
||
45 | 'class' => AccessControl::class, |
||
46 | 'ruleConfig' => [ |
||
47 | 'class' => AccessRuleFilter::class, |
||
48 | ], |
||
49 | 'rules' => [ |
||
50 | [ |
||
51 | 'allow' => true, |
||
52 | 'roles' => ['admin'], |
||
53 | ], |
||
54 | ], |
||
55 | ], |
||
56 | ]; |
||
57 | } |
||
58 | |||
59 | public function actionIndex() |
||
60 | { |
||
61 | /** @var RuleSearch $searchModel */ |
||
62 | $searchModel = $this->make(RuleSearch::class); |
||
63 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
||
64 | |||
65 | return $this->render( |
||
66 | 'index', |
||
67 | [ |
||
68 | 'searchModel' => $searchModel, |
||
69 | 'dataProvider' => $dataProvider, |
||
70 | ] |
||
71 | ); |
||
72 | } |
||
73 | |||
74 | public function actionCreate() |
||
96 | |||
97 | public function actionUpdate($name) |
||
98 | { |
||
129 | |||
130 | public function actionDelete($name) |
||
140 | |||
141 | /** |
||
142 | * @param $name |
||
143 | * |
||
144 | * @throws NotFoundHttpException |
||
145 | * @return mixed|null|\yii\rbac\Rule |
||
146 | */ |
||
147 | protected function findRule($name) |
||
157 | } |
||
158 |
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: