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