src/Core/Controller/ParameterController.php line 16

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Core\Controller;
  3. use App\Core\Service\ParameterService;
  4. use App\Framework\Controller\APIController;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. #[Route(path'/api/config')]
  7. class ParameterController extends APIController
  8. {
  9.     /**
  10.      * @return mixed[]
  11.      */
  12.     #[Route(path''methods: ['GET'])]
  13.     public function listAction(ParameterService $parameterService): array
  14.     {
  15.         return $parameterService->getParameters();
  16.     }
  17.     /**
  18.      * @throws EntityNotFoundException
  19.      * @throws ORMException
  20.      *
  21.      * @return mixed[]
  22.      */
  23.     #[Route(path''methods: ['PUT'])]
  24.     public function putAction(ParameterService $parameterService): array
  25.     {
  26.         $this->denyAccessUnlessGranted('ROLE_ADMIN');
  27.         $parameters $this->getRequestBody();
  28.         $parameterService->updateParameters($parameters);
  29.         // return the updated params
  30.         return $parameterService->getParameters();
  31.     }
  32. }