@@ -17,22 +17,22 @@ |
||
17 | 17 | |
18 | 18 | class AddAppConfigAction |
19 | 19 | { |
20 | - public function __construct( |
|
20 | + public function __construct( |
|
21 | 21 | private Security $security, |
22 | 22 | private EntityManagerInterface $manager, |
23 | 23 | private ConfigService $configService, |
24 | 24 | private HydratorService $hydratorService |
25 | - ) {} |
|
25 | + ) {} |
|
26 | 26 | |
27 | - public function __invoke(Request $request): JsonResponse |
|
28 | - { |
|
27 | + public function __invoke(Request $request): JsonResponse |
|
28 | + { |
|
29 | 29 | try { |
30 | - $json = json_decode($request->getContent(), true); |
|
31 | - $people = $this->manager->getRepository(People::class)->find($json['people']); |
|
32 | - $config = $this->configService->addConfig($people, $json['configKey'], $json['configValue']); |
|
33 | - return new JsonResponse($this->hydratorService->item(Config::class, $config->getId(), "config:read"), Response::HTTP_OK); |
|
30 | + $json = json_decode($request->getContent(), true); |
|
31 | + $people = $this->manager->getRepository(People::class)->find($json['people']); |
|
32 | + $config = $this->configService->addConfig($people, $json['configKey'], $json['configValue']); |
|
33 | + return new JsonResponse($this->hydratorService->item(Config::class, $config->getId(), "config:read"), Response::HTTP_OK); |
|
34 | 34 | } catch (Exception $e) { |
35 | - return new JsonResponse($this->hydratorService->error($e)); |
|
35 | + return new JsonResponse($this->hydratorService->error($e)); |
|
36 | + } |
|
36 | 37 | } |
37 | - } |
|
38 | 38 | } |