@@ -14,8 +14,8 @@ |
||
14 | 14 | */ |
15 | 15 | class RouteRepository extends ServiceEntityRepository |
16 | 16 | { |
17 | - public function __construct(ManagerRegistry $registry) |
|
18 | - { |
|
17 | + public function __construct(ManagerRegistry $registry) |
|
18 | + { |
|
19 | 19 | parent::__construct($registry, Routes::class); |
20 | - } |
|
20 | + } |
|
21 | 21 | } |
@@ -14,8 +14,8 @@ |
||
14 | 14 | */ |
15 | 15 | class MenuRepository extends ServiceEntityRepository |
16 | 16 | { |
17 | - public function __construct(ManagerRegistry $registry) |
|
18 | - { |
|
17 | + public function __construct(ManagerRegistry $registry) |
|
18 | + { |
|
19 | 19 | parent::__construct($registry, Menu::class); |
20 | - } |
|
20 | + } |
|
21 | 21 | } |
@@ -11,58 +11,58 @@ discard block |
||
11 | 11 | |
12 | 12 | class GetActionByPeopleAction |
13 | 13 | { |
14 | - private $manager = null; |
|
15 | - private $security = null; |
|
14 | + private $manager = null; |
|
15 | + private $security = null; |
|
16 | 16 | |
17 | - public function __construct(Security $security, EntityManagerInterface $entityManager) |
|
18 | - { |
|
17 | + public function __construct(Security $security, EntityManagerInterface $entityManager) |
|
18 | + { |
|
19 | 19 | $this->manager = $entityManager; |
20 | 20 | $this->security = $security; |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | - public function __invoke(Request $request): JsonResponse |
|
24 | - { |
|
23 | + public function __invoke(Request $request): JsonResponse |
|
24 | + { |
|
25 | 25 | try { |
26 | - $menu = []; |
|
27 | - $company = $request->query->get('myCompany', null); |
|
26 | + $menu = []; |
|
27 | + $company = $request->query->get('myCompany', null); |
|
28 | 28 | |
29 | - if ($company === null) { |
|
29 | + if ($company === null) { |
|
30 | 30 | throw new Exception("Company not found", 404); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | - $myCompany = $this->manager->getRepository(People::class)->find($company); |
|
33 | + $myCompany = $this->manager->getRepository(People::class)->find($company); |
|
34 | 34 | |
35 | - if ($myCompany === null) { |
|
35 | + if ($myCompany === null) { |
|
36 | 36 | throw new Exception("Company not found", 404); |
37 | - } |
|
37 | + } |
|
38 | 38 | |
39 | - $currentUser = $this->security->getToken()->getUser(); |
|
40 | - $userPeople = $currentUser->getPeople(); |
|
39 | + $currentUser = $this->security->getToken()->getUser(); |
|
40 | + $userPeople = $currentUser->getPeople(); |
|
41 | 41 | |
42 | - $menu = $this->getMenuByPeople($userPeople, $myCompany); |
|
42 | + $menu = $this->getMenuByPeople($userPeople, $myCompany); |
|
43 | 43 | |
44 | - return new JsonResponse([ |
|
44 | + return new JsonResponse([ |
|
45 | 45 | 'response' => [ |
46 | - 'data' => $menu, |
|
47 | - 'count' => 1, |
|
48 | - 'error' => '', |
|
49 | - 'success' => true, |
|
46 | + 'data' => $menu, |
|
47 | + 'count' => 1, |
|
48 | + 'error' => '', |
|
49 | + 'success' => true, |
|
50 | 50 | ], |
51 | - ]); |
|
51 | + ]); |
|
52 | 52 | } catch (\Exception $e) { |
53 | - return new JsonResponse([ |
|
53 | + return new JsonResponse([ |
|
54 | 54 | 'response' => [ |
55 | - 'data' => [], |
|
56 | - 'count' => 0, |
|
57 | - 'error' => $e->getMessage(), |
|
58 | - 'success' => false, |
|
55 | + 'data' => [], |
|
56 | + 'count' => 0, |
|
57 | + 'error' => $e->getMessage(), |
|
58 | + 'success' => false, |
|
59 | 59 | ], |
60 | - ]); |
|
60 | + ]); |
|
61 | + } |
|
61 | 62 | } |
62 | - } |
|
63 | 63 | |
64 | - private function getMenuByPeople(People $userPeople, People $myCompany) |
|
65 | - { |
|
64 | + private function getMenuByPeople(People $userPeople, People $myCompany) |
|
65 | + { |
|
66 | 66 | $return = []; |
67 | 67 | $connection = $this->manager->getConnection(); |
68 | 68 | |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | GROUP BY action.id'; |
79 | 79 | |
80 | 80 | $params = [ |
81 | - 'myCompany' => $myCompany->getId(), |
|
82 | - 'userPeople' => $userPeople->getId(), |
|
83 | - 'route' => $this->route, |
|
81 | + 'myCompany' => $myCompany->getId(), |
|
82 | + 'userPeople' => $userPeople->getId(), |
|
83 | + 'route' => $this->route, |
|
84 | 84 | ]; |
85 | 85 | |
86 | 86 | $result = $connection->executeQuery($sql, $params)->fetchAllAssociative(); |
87 | 87 | |
88 | 88 | foreach ($result as $action) { |
89 | - $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']); |
|
89 | + $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $return; |
93 | - } |
|
93 | + } |
|
94 | 94 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return $this; |
103 | 103 | } |
104 | 104 | |
105 | - public function getConfigs(bool $decode = false): string|array |
|
105 | + public function getConfigs(bool $decode = false): string | array |
|
106 | 106 | { |
107 | 107 | // Ensure we're decoding a string, even if it was temporarily an array internally |
108 | 108 | $configString = is_array($this->configs) ? json_encode($this->configs) : $this->configs; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | return $this->setConfigs($configs); |
117 | 117 | } |
118 | 118 | |
119 | - public function setConfigs(string|array|object $configs): self |
|
119 | + public function setConfigs(string | array | object $configs): self |
|
120 | 120 | { |
121 | 121 | if (is_string($configs)) |
122 | 122 | $configs = json_decode($configs, true); |
@@ -118,8 +118,9 @@ |
||
118 | 118 | |
119 | 119 | public function setConfigs(string|array|object $configs): self |
120 | 120 | { |
121 | - if (is_string($configs)) |
|
122 | - $configs = json_decode($configs, true); |
|
121 | + if (is_string($configs)) { |
|
122 | + $configs = json_decode($configs, true); |
|
123 | + } |
|
123 | 124 | |
124 | 125 | $this->configs = json_encode($configs); |
125 | 126 | return $this; |
@@ -10,27 +10,27 @@ |
||
10 | 10 | class FileService |
11 | 11 | { |
12 | 12 | |
13 | - public function __construct( |
|
13 | + public function __construct( |
|
14 | 14 | private EntityManagerInterface $manager, |
15 | 15 | private DomainService $domainService |
16 | 16 | |
17 | - ) {} |
|
17 | + ) {} |
|
18 | 18 | |
19 | 19 | |
20 | - public function getFileUrl(People $people): ?array |
|
21 | - { |
|
20 | + public function getFileUrl(People $people): ?array |
|
21 | + { |
|
22 | 22 | if ($people->getImage() instanceof File) |
23 | - return [ |
|
23 | + return [ |
|
24 | 24 | 'id' => $people->getImage()->getId(), |
25 | 25 | 'domain' => $this->domainService->getMainDomain(), |
26 | 26 | 'url' => '/files/' . $people->getImage()->getId() . '/download' |
27 | - ]; |
|
27 | + ]; |
|
28 | 28 | |
29 | 29 | return null; |
30 | - } |
|
30 | + } |
|
31 | 31 | |
32 | - public function addFile(People $people, string $content, string $context, string $fileName, string $fileType, string $extension): File |
|
33 | - { |
|
32 | + public function addFile(People $people, string $content, string $context, string $fileName, string $fileType, string $extension): File |
|
33 | + { |
|
34 | 34 | return $this->manager->getRepository(File::class)->addFile($people, $content, $context, $fileName, $fileType, $extension); |
35 | - } |
|
35 | + } |
|
36 | 36 | } |
@@ -19,12 +19,13 @@ |
||
19 | 19 | |
20 | 20 | public function getFileUrl(People $people): ?array |
21 | 21 | { |
22 | - if ($people->getImage() instanceof File) |
|
23 | - return [ |
|
22 | + if ($people->getImage() instanceof File) { |
|
23 | + return [ |
|
24 | 24 | 'id' => $people->getImage()->getId(), |
25 | 25 | 'domain' => $this->domainService->getMainDomain(), |
26 | 26 | 'url' => '/files/' . $people->getImage()->getId() . '/download' |
27 | 27 | ]; |
28 | + } |
|
28 | 29 | |
29 | 30 | return null; |
30 | 31 | } |
@@ -70,31 +70,31 @@ |
||
70 | 70 | #[Entity(repositoryClass: FileRepository::class)] |
71 | 71 | class File |
72 | 72 | { |
73 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'contract:read', 'model:read', 'people:read'])] |
|
73 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'contract:read', 'model:read', 'people:read'])] |
|
74 | 74 | #[Column(type: 'integer', nullable: false)] |
75 | 75 | #[Id] |
76 | 76 | #[GeneratedValue(strategy: 'IDENTITY')] |
77 | 77 | private int $id; |
78 | 78 | |
79 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
79 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
80 | 80 | #[NotBlank] |
81 | 81 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['fileType' => 'exact'])] |
82 | 82 | #[Column(type: 'string', length: 255, nullable: false)] |
83 | 83 | private string $fileType; |
84 | 84 | |
85 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
85 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
86 | 86 | #[NotBlank] |
87 | 87 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['fileName' => 'exact'])] |
88 | 88 | #[Column(type: 'string', length: 255, nullable: false)] |
89 | 89 | private string $fileName; |
90 | 90 | |
91 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
91 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
92 | 92 | #[NotBlank] |
93 | 93 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['context' => 'exact'])] |
94 | 94 | #[Column(type: 'string', length: 255, nullable: false)] |
95 | 95 | private string $context; |
96 | 96 | |
97 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
97 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
98 | 98 | #[NotBlank] |
99 | 99 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['extension' => 'exact'])] |
100 | 100 | #[Column(type: 'string', length: 255, nullable: false)] |
@@ -39,7 +39,7 @@ |
||
39 | 39 | #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
40 | 40 | #[ORM\Id] |
41 | 41 | #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
42 | - #[Groups(['spool_item:read', 'spool:read',])] |
|
42 | + #[Groups(['spool_item:read', 'spool:read', ])] |
|
43 | 43 | private $id; |
44 | 44 | |
45 | 45 |