Skip to content

Commit

Permalink
Upgrade $request->get('key') calls on array to $request->all('key'); (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed May 3, 2022
1 parent 5718183 commit a05e58a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -42890,11 +42890,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/SecurityBundle/Controller/ResettingController.php

-
message: "#^Argument of an invalid type float\\|int\\<min, \\-1\\>\\|int\\<1, max\\>\\|string\\|true supplied for foreach, only iterables are supported\\.$#"
count: 1
path: src/Sulu/Bundle/SecurityBundle/Controller/RoleController.php

-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<SuluSecurityBundle\\:SecurityType\\>\\:\\:findSecurityTypeById\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -43060,11 +43055,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/SecurityBundle/Controller/RoleController.php

-
message: "#^Parameter \\#2 \\$default of method Symfony\\\\Component\\\\HttpFoundation\\\\InputBag\\<bool\\|float\\|int\\|string\\>\\:\\:get\\(\\) expects bool\\|float\\|int\\|string\\|null, array given\\.$#"
count: 1
path: src/Sulu/Bundle/SecurityBundle/Controller/RoleController.php

-
message: "#^Parameter \\#2 \\$value of method Sulu\\\\Component\\\\Rest\\\\ListBuilder\\\\ListBuilderInterface\\:\\:where\\(\\) expects string, false given\\.$#"
count: 1
Expand Down
9 changes: 5 additions & 4 deletions src/Sulu/Bundle/SecurityBundle/Controller/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,15 @@ public function postAction(Request $request)
$role->setKey($key);
$role->setSystem($system);

$permissions = $request->request->get('permissions');
$permissions = $request->request->all('permissions');

if (!empty($permissions)) {
foreach ($permissions as $permissionData) {
$this->addPermission($role, $permissionData);
}
}

$securityTypeData = $request->request->get('securityType');
$securityTypeData = $request->request->all('securityType');
if ($this->checkSecurityTypeData($securityTypeData)) {
$this->setSecurityType($role, $securityTypeData);
}
Expand Down Expand Up @@ -285,11 +286,11 @@ public function putAction(Request $request, $id)
$role->setKey($key);
$role->setSystem($system);

if (!$this->processPermissions($role, $request->request->get('permissions', []))) {
if (!$this->processPermissions($role, $request->request->all('permissions'))) {
throw new RestException('Could not update dependencies!');
}

$securityTypeData = $request->request->get('securityType');
$securityTypeData = $request->request->all('securityType');
if ($this->checkSecurityTypeData($securityTypeData)) {
$this->setSecurityType($role, $securityTypeData);
} else {
Expand Down

0 comments on commit a05e58a

Please sign in to comment.