Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade $request->get('key') calls on array to $request->all('key'); #6587

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -42895,11 +42895,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 @@ -43065,11 +43060,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