1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Controller; |
4
|
|
|
|
5
|
|
|
use ControleOnline\Entity\Config; |
6
|
|
|
use ControleOnline\Entity\Module; |
7
|
|
|
use ControleOnline\Entity\People; |
|
|
|
|
8
|
|
|
use ControleOnline\Service\ConfigService; |
9
|
|
|
use ControleOnline\Service\HydratorService; |
10
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
|
|
11
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
|
|
|
12
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
|
13
|
|
|
use Exception; |
14
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
|
|
|
|
15
|
|
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface |
|
|
|
|
16
|
|
|
AS Security; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
|
20
|
|
|
class AddAppConfigAction |
21
|
|
|
{ |
22
|
|
|
public function __construct( |
23
|
|
|
private Security $security, |
24
|
|
|
private EntityManagerInterface $manager, |
25
|
|
|
private ConfigService $configService, |
26
|
|
|
private HydratorService $hydratorService |
27
|
|
|
) {} |
28
|
|
|
|
29
|
|
|
public function __invoke(Request $request): JsonResponse |
30
|
|
|
{ |
31
|
|
|
try { |
32
|
|
|
$json = json_decode($request->getContent(), true); |
33
|
|
|
$people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people'])); |
34
|
|
|
$module = $this->manager->getRepository(Module::class)->find(preg_replace("/[^0-9]/", "", $json['module'])); |
35
|
|
|
$configValue = json_decode($json['configValue'], true); |
36
|
|
|
$config = $this->configService->addConfig( |
37
|
|
|
$people, |
38
|
|
|
$json['configKey'], |
39
|
|
|
$configValue, |
40
|
|
|
$module, |
41
|
|
|
$json['visibility'] |
42
|
|
|
); |
43
|
|
|
|
44
|
|
|
return new JsonResponse($this->hydratorService->item(Config::class, $config->getId(), "config:read"), Response::HTTP_OK); |
45
|
|
|
} catch (Exception $e) { |
46
|
|
|
return new JsonResponse($this->hydratorService->error($e)); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths