Skip to content
Snippets Groups Projects
Commit 643ac803 authored by Moreau Elise's avatar Moreau Elise
Browse files

resolve group id bug

parent 6f0274a1
No related branches found
No related tags found
No related merge requests found
...@@ -14,10 +14,16 @@ class AddUsersGroupAction extends GroupAction ...@@ -14,10 +14,16 @@ class AddUsersGroupAction extends GroupAction
*/ */
protected function action(): Response protected function action(): Response
{ {
$parsedRequestBody = (array)$this->request->getParsedBody();
$groupId = (int) $this->resolveArg('id'); $groupId = (int) $this->resolveArg('id');
$group = $this->groupRepository->find($groupId); if (!isset($parsedRequestBody['ids']))
{
return $this->response
->withHeader('Location', '/groups/' . $groupId)
->withStatus(302);
}
$parsedRequestBody = (array)$this->request->getParsedBody(); $group = $this->groupRepository->find($groupId);
$user_ids = $parsedRequestBody['ids']; $user_ids = $parsedRequestBody['ids'];
if (!isset($group)) { if (!isset($group)) {
... ...
......
...@@ -50,7 +50,7 @@ class CreateGroupAction extends GroupAction ...@@ -50,7 +50,7 @@ class CreateGroupAction extends GroupAction
$this->logger->info("Group has been created."); $this->logger->info("Group has been created.");
return $this->response return $this->response
->withHeader('Location', '/groups' . $groupId) ->withHeader('Location', '/groups' . $group->getId())
->withStatus(302); ->withStatus(302);
} }
... ...
......
File changed. Contains only whitespace changes. Show whitespace changes.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment