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

create an action to view the modify form

parent f3562b3d
No related branches found
No related tags found
No related merge requests found
<?php
declare(strict_types=1);
namespace App\Application\Actions\User;
use Psr\Http\Message\ResponseInterface as Response;
use App\Domain\User\UserNotFoundException;
class ViewModifyForm extends UserAction
{
/**
* {@inheritdoc}
*/
protected function action(): Response
{
if (!isset($_SESSION['userId'])) {
return $this->response
->withHeader('Location', '/login')
->withStatus(302);
}
$user = $this->userRepository->find($_SESSION['userId']);
if (!isset($user)) {
throw new UserNotFoundException();
}
return $this->twig->render($this->response, "/user/modify_user.twig", ["user" => $user]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment