<?php declare(strict_types=1);
namespace App\Core\Controller;
use App\Core\Service\ParameterService;
use App\Framework\Controller\APIController;
use Symfony\Component\Routing\Annotation\Route;
#[Route(path: '/api/config')]
class ParameterController extends APIController
{
/**
* @return mixed[]
*/
#[Route(path: '', methods: ['GET'])]
public function listAction(ParameterService $parameterService): array
{
return $parameterService->getParameters();
}
/**
* @throws EntityNotFoundException
* @throws ORMException
*
* @return mixed[]
*/
#[Route(path: '', methods: ['PUT'])]
public function putAction(ParameterService $parameterService): array
{
$this->denyAccessUnlessGranted('ROLE_ADMIN');
$parameters = $this->getRequestBody();
$parameterService->updateParameters($parameters);
// return the updated params
return $parameterService->getParameters();
}
}