1 | <?php |
||||
2 | |||||
3 | namespace app\controllers\admin; |
||||
4 | |||||
5 | use Yii; |
||||
6 | use app\traits\{LanguageTrait, AdminBeforeActionTrait, AccessTrait}; |
||||
7 | use Itstructure\AdminModule\controllers\AdminController; |
||||
8 | |||||
9 | /** |
||||
10 | * Class SettingController |
||||
11 | * SettingController implements the CRUD actions for Setting model. |
||||
12 | * |
||||
13 | * @package app\controllers\admin |
||||
14 | */ |
||||
15 | class SettingController extends AdminController |
||||
16 | { |
||||
17 | use LanguageTrait, AdminBeforeActionTrait, AccessTrait; |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
18 | |||||
19 | /** |
||||
20 | * List of records. |
||||
21 | * |
||||
22 | * @return string |
||||
23 | */ |
||||
24 | public function actionIndex() |
||||
25 | { |
||||
26 | if (!$this->checkAccessToAdministrate()) { |
||||
27 | return $this->accessError(); |
||||
28 | } |
||||
29 | |||||
30 | /* @var $model \app\models\Setting */ |
||||
31 | $model = Yii::$app->get('settings') |
||||
32 | ->setModel() |
||||
33 | ->getSettings(); |
||||
34 | |||||
35 | if (Yii::$app->request->isPost && $model->load(Yii::$app->request->post()) && $model->save()) { |
||||
0 ignored issues
–
show
It seems like
Yii::app->request->post() can also be of type object ; however, parameter $data of yii\base\Model::load() does only seem to accept array , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
36 | return $this->redirect([ |
||||
0 ignored issues
–
show
|
|||||
37 | '/'.$this->shortLanguage.'/admin/settings' |
||||
38 | ]); |
||||
39 | } |
||||
40 | |||||
41 | $fields = [ |
||||
42 | 'model' => $model, |
||||
43 | 'roles' => Yii::$app->authManager->getRoles() |
||||
0 ignored issues
–
show
The method
getRoles() does not exist on null .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||
44 | ]; |
||||
45 | |||||
46 | return $this->render('index', $fields); |
||||
47 | } |
||||
48 | } |
||||
49 |