@@ -22,65 +22,65 @@ |
||
22 | 22 | |
23 | 23 | public function findOneByCityStateCountryOfPeople(string $city, string $state, string $country, People $people): ?Address |
24 | 24 | { |
25 | - $result = $this->createQueryBuilder('a') |
|
26 | - ->innerJoin ('a.street' , 's') |
|
27 | - ->innerJoin ('s.district', 'd') |
|
28 | - ->innerJoin ('d.city' , 'c') |
|
29 | - ->innerJoin ('c.state' , 'e') |
|
30 | - ->innerJoin ('e.country' , 'u') |
|
25 | + $result = $this->createQueryBuilder('a') |
|
26 | + ->innerJoin ('a.street' , 's') |
|
27 | + ->innerJoin ('s.district', 'd') |
|
28 | + ->innerJoin ('d.city' , 'c') |
|
29 | + ->innerJoin ('c.state' , 'e') |
|
30 | + ->innerJoin ('e.country' , 'u') |
|
31 | 31 | |
32 | - ->andWhere ('c.city = :city' ) |
|
33 | - ->andWhere ('e.uf = :state' ) |
|
34 | - ->andWhere ('u.countryname = :country') |
|
35 | - ->andWhere ('a.people = :people' ) |
|
32 | + ->andWhere ('c.city = :city' ) |
|
33 | + ->andWhere ('e.uf = :state' ) |
|
34 | + ->andWhere ('u.countryname = :country') |
|
35 | + ->andWhere ('a.people = :people' ) |
|
36 | 36 | |
37 | - ->setParameter ('city' , $city ) |
|
38 | - ->setParameter ('state' , $state ) |
|
39 | - ->setParameter ('country', $country) |
|
40 | - ->setParameter ('people' , $people) |
|
37 | + ->setParameter ('city' , $city ) |
|
38 | + ->setParameter ('state' , $state ) |
|
39 | + ->setParameter ('country', $country) |
|
40 | + ->setParameter ('people' , $people) |
|
41 | 41 | |
42 | - ->getQuery() |
|
43 | - ->getResult() |
|
44 | - ; |
|
42 | + ->getQuery() |
|
43 | + ->getResult() |
|
44 | + ; |
|
45 | 45 | |
46 | - if (empty($result)) |
|
46 | + if (empty($result)) |
|
47 | 47 | return null; |
48 | 48 | |
49 | - return $result[0]; |
|
49 | + return $result[0]; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function findPeopleAddressBy(People $people, array $criteria): ?Address |
53 | 53 | { |
54 | - $result = $this->createQueryBuilder('a') |
|
55 | - ->innerJoin ('a.street' , 's') |
|
56 | - ->innerJoin ('s.district', 'd') |
|
57 | - ->innerJoin ('d.city' , 'c') |
|
58 | - ->innerJoin ('c.state' , 'e') |
|
59 | - ->innerJoin ('e.country' , 'u') |
|
54 | + $result = $this->createQueryBuilder('a') |
|
55 | + ->innerJoin ('a.street' , 's') |
|
56 | + ->innerJoin ('s.district', 'd') |
|
57 | + ->innerJoin ('d.city' , 'c') |
|
58 | + ->innerJoin ('c.state' , 'e') |
|
59 | + ->innerJoin ('e.country' , 'u') |
|
60 | 60 | |
61 | - ->andWhere ('a.people = :people' ) |
|
62 | - ->andWhere ('u.countryname = :country' ) |
|
63 | - ->andWhere ('(e.uf = :state OR e.state = :state)') |
|
64 | - ->andWhere ('c.city = :city' ) |
|
65 | - ->andWhere ('d.district = :district') |
|
66 | - ->andWhere ('s.street = :street' ) |
|
67 | - ->andWhere ('a.number = :number' ) |
|
61 | + ->andWhere ('a.people = :people' ) |
|
62 | + ->andWhere ('u.countryname = :country' ) |
|
63 | + ->andWhere ('(e.uf = :state OR e.state = :state)') |
|
64 | + ->andWhere ('c.city = :city' ) |
|
65 | + ->andWhere ('d.district = :district') |
|
66 | + ->andWhere ('s.street = :street' ) |
|
67 | + ->andWhere ('a.number = :number' ) |
|
68 | 68 | |
69 | - ->setParameter ('people' , $people) |
|
70 | - ->setParameter ('country' , $criteria['country'] ) |
|
71 | - ->setParameter ('state' , $criteria['state'] ) |
|
72 | - ->setParameter ('city' , $criteria['city'] ) |
|
73 | - ->setParameter ('district', $criteria['district']) |
|
74 | - ->setParameter ('street' , $criteria['street'] ) |
|
75 | - ->setParameter ('number' , $criteria['number'] ) |
|
69 | + ->setParameter ('people' , $people) |
|
70 | + ->setParameter ('country' , $criteria['country'] ) |
|
71 | + ->setParameter ('state' , $criteria['state'] ) |
|
72 | + ->setParameter ('city' , $criteria['city'] ) |
|
73 | + ->setParameter ('district', $criteria['district']) |
|
74 | + ->setParameter ('street' , $criteria['street'] ) |
|
75 | + ->setParameter ('number' , $criteria['number'] ) |
|
76 | 76 | |
77 | - ->getQuery() |
|
78 | - ->getResult() |
|
79 | - ; |
|
77 | + ->getQuery() |
|
78 | + ->getResult() |
|
79 | + ; |
|
80 | 80 | |
81 | - if (empty($result)) |
|
81 | + if (empty($result)) |
|
82 | 82 | return null; |
83 | 83 | |
84 | - return $result[0]; |
|
84 | + return $result[0]; |
|
85 | 85 | } |
86 | 86 | } |
@@ -14,91 +14,91 @@ discard block |
||
14 | 14 | |
15 | 15 | class GetActionByPeopleAction |
16 | 16 | { |
17 | - /** |
|
18 | - * Entity Manager |
|
19 | - * |
|
20 | - * @var EntityManagerInterface |
|
21 | - */ |
|
22 | - private $manager = null; |
|
23 | - |
|
24 | - /** |
|
25 | - * Request |
|
26 | - * |
|
27 | - * @var Request |
|
28 | - */ |
|
29 | - private $request = null; |
|
30 | - |
|
31 | - /** |
|
32 | - * Security |
|
33 | - * |
|
34 | - * @var Security |
|
35 | - */ |
|
36 | - private $security = null; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var \ControleOnline\Repository\MenuRepository |
|
40 | - */ |
|
41 | - private $repository = null; |
|
42 | - |
|
43 | - |
|
44 | - public function __construct(Security $security, EntityManagerInterface $entityManager) |
|
45 | - { |
|
17 | + /** |
|
18 | + * Entity Manager |
|
19 | + * |
|
20 | + * @var EntityManagerInterface |
|
21 | + */ |
|
22 | + private $manager = null; |
|
23 | + |
|
24 | + /** |
|
25 | + * Request |
|
26 | + * |
|
27 | + * @var Request |
|
28 | + */ |
|
29 | + private $request = null; |
|
30 | + |
|
31 | + /** |
|
32 | + * Security |
|
33 | + * |
|
34 | + * @var Security |
|
35 | + */ |
|
36 | + private $security = null; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var \ControleOnline\Repository\MenuRepository |
|
40 | + */ |
|
41 | + private $repository = null; |
|
42 | + |
|
43 | + |
|
44 | + public function __construct(Security $security, EntityManagerInterface $entityManager) |
|
45 | + { |
|
46 | 46 | $this->manager = $entityManager; |
47 | 47 | $this->security = $security; |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function __invoke(Request $request): JsonResponse |
|
51 | - { |
|
50 | + public function __invoke(Request $request): JsonResponse |
|
51 | + { |
|
52 | 52 | try { |
53 | 53 | |
54 | - $menu = []; |
|
54 | + $menu = []; |
|
55 | 55 | |
56 | - $company = $request->query->get('myCompany', null); |
|
56 | + $company = $request->query->get('myCompany', null); |
|
57 | 57 | |
58 | - if ($company === null) |
|
58 | + if ($company === null) |
|
59 | 59 | throw new Exception("Company not found", 404); |
60 | 60 | |
61 | 61 | |
62 | - $myCompany = $this->manager->getRepository(People::class) |
|
62 | + $myCompany = $this->manager->getRepository(People::class) |
|
63 | 63 | ->find($company); |
64 | 64 | |
65 | - if ($myCompany === null) |
|
65 | + if ($myCompany === null) |
|
66 | 66 | throw new Exception("Company not found", 404); |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | - $currentUser = $this->security->getUser(); |
|
71 | - /** |
|
72 | - * @var People |
|
73 | - */ |
|
74 | - $userPeople = $currentUser->getPeople(); |
|
70 | + $currentUser = $this->security->getUser(); |
|
71 | + /** |
|
72 | + * @var People |
|
73 | + */ |
|
74 | + $userPeople = $currentUser->getPeople(); |
|
75 | 75 | |
76 | - $menu = $this->getMenuByPeople($userPeople, $myCompany); |
|
76 | + $menu = $this->getMenuByPeople($userPeople, $myCompany); |
|
77 | 77 | |
78 | 78 | |
79 | - return new JsonResponse([ |
|
79 | + return new JsonResponse([ |
|
80 | 80 | 'response' => [ |
81 | - 'data' => $menu, |
|
82 | - 'count' => 1, |
|
83 | - 'error' => '', |
|
84 | - 'success' => true, |
|
81 | + 'data' => $menu, |
|
82 | + 'count' => 1, |
|
83 | + 'error' => '', |
|
84 | + 'success' => true, |
|
85 | 85 | ], |
86 | - ]); |
|
86 | + ]); |
|
87 | 87 | } catch (\Exception $e) { |
88 | 88 | |
89 | - return new JsonResponse([ |
|
89 | + return new JsonResponse([ |
|
90 | 90 | 'response' => [ |
91 | - 'data' => [], |
|
92 | - 'count' => 0, |
|
93 | - 'error' => $e->getMessage(), |
|
94 | - 'success' => false, |
|
91 | + 'data' => [], |
|
92 | + 'count' => 0, |
|
93 | + 'error' => $e->getMessage(), |
|
94 | + 'success' => false, |
|
95 | 95 | ], |
96 | - ]); |
|
96 | + ]); |
|
97 | + } |
|
97 | 98 | } |
98 | - } |
|
99 | 99 | |
100 | - private function getMenuByPeople(People $userPeople, People $myCompany) |
|
101 | - { |
|
100 | + private function getMenuByPeople(People $userPeople, People $myCompany) |
|
101 | + { |
|
102 | 102 | |
103 | 103 | $return = []; |
104 | 104 | $connection = $this->manager->getConnection(); |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | $result = $statement->fetchAll(); |
134 | 134 | |
135 | 135 | foreach ($result as $action) { |
136 | - $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']); |
|
136 | + $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $return; |
140 | - } |
|
140 | + } |
|
141 | 141 | } |
@@ -14,92 +14,92 @@ discard block |
||
14 | 14 | |
15 | 15 | class GetMenuByPeopleAction |
16 | 16 | { |
17 | - /** |
|
18 | - * Entity Manager |
|
19 | - * |
|
20 | - * @var EntityManagerInterface |
|
21 | - */ |
|
22 | - private $manager = null; |
|
23 | - |
|
24 | - /** |
|
25 | - * Request |
|
26 | - * |
|
27 | - * @var Request |
|
28 | - */ |
|
29 | - private $request = null; |
|
30 | - |
|
31 | - /** |
|
32 | - * Security |
|
33 | - * |
|
34 | - * @var Security |
|
35 | - */ |
|
36 | - private $security = null; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var \ControleOnline\Repository\MenuRepository |
|
40 | - */ |
|
41 | - private $repository = null; |
|
42 | - |
|
43 | - |
|
44 | - public function __construct(Security $security, EntityManagerInterface $entityManager) |
|
45 | - { |
|
17 | + /** |
|
18 | + * Entity Manager |
|
19 | + * |
|
20 | + * @var EntityManagerInterface |
|
21 | + */ |
|
22 | + private $manager = null; |
|
23 | + |
|
24 | + /** |
|
25 | + * Request |
|
26 | + * |
|
27 | + * @var Request |
|
28 | + */ |
|
29 | + private $request = null; |
|
30 | + |
|
31 | + /** |
|
32 | + * Security |
|
33 | + * |
|
34 | + * @var Security |
|
35 | + */ |
|
36 | + private $security = null; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var \ControleOnline\Repository\MenuRepository |
|
40 | + */ |
|
41 | + private $repository = null; |
|
42 | + |
|
43 | + |
|
44 | + public function __construct(Security $security, EntityManagerInterface $entityManager) |
|
45 | + { |
|
46 | 46 | $this->manager = $entityManager; |
47 | 47 | $this->security = $security; |
48 | 48 | $this->repository = $this->manager->getRepository(\ControleOnline\Entity\Menu::class); |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - public function __invoke(Request $request): JsonResponse |
|
52 | - { |
|
51 | + public function __invoke(Request $request): JsonResponse |
|
52 | + { |
|
53 | 53 | try { |
54 | 54 | |
55 | - $menu = []; |
|
55 | + $menu = []; |
|
56 | 56 | |
57 | - $company = $request->query->get('myCompany', null); |
|
57 | + $company = $request->query->get('myCompany', null); |
|
58 | 58 | |
59 | - if ($company === null) |
|
59 | + if ($company === null) |
|
60 | 60 | throw new Exception("Company not found", 404); |
61 | 61 | |
62 | 62 | |
63 | - $myCompany = $this->manager->getRepository(People::class) |
|
63 | + $myCompany = $this->manager->getRepository(People::class) |
|
64 | 64 | ->find($company); |
65 | 65 | |
66 | - if ($myCompany === null) |
|
66 | + if ($myCompany === null) |
|
67 | 67 | throw new Exception("Company not found", 404); |
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - $currentUser = $this->security->getUser(); |
|
72 | - /** |
|
73 | - * @var People |
|
74 | - */ |
|
75 | - $userPeople = $currentUser->getPeople(); |
|
71 | + $currentUser = $this->security->getUser(); |
|
72 | + /** |
|
73 | + * @var People |
|
74 | + */ |
|
75 | + $userPeople = $currentUser->getPeople(); |
|
76 | 76 | |
77 | - $menu = $this->getMenuByPeople($userPeople, $myCompany); |
|
77 | + $menu = $this->getMenuByPeople($userPeople, $myCompany); |
|
78 | 78 | |
79 | 79 | |
80 | - return new JsonResponse([ |
|
80 | + return new JsonResponse([ |
|
81 | 81 | 'response' => [ |
82 | - 'data' => $menu, |
|
83 | - 'count' => 1, |
|
84 | - 'error' => '', |
|
85 | - 'success' => true, |
|
82 | + 'data' => $menu, |
|
83 | + 'count' => 1, |
|
84 | + 'error' => '', |
|
85 | + 'success' => true, |
|
86 | 86 | ], |
87 | - ]); |
|
87 | + ]); |
|
88 | 88 | } catch (\Exception $e) { |
89 | 89 | |
90 | - return new JsonResponse([ |
|
90 | + return new JsonResponse([ |
|
91 | 91 | 'response' => [ |
92 | - 'data' => [], |
|
93 | - 'count' => 0, |
|
94 | - 'error' => $e->getMessage(), |
|
95 | - 'success' => false, |
|
92 | + 'data' => [], |
|
93 | + 'count' => 0, |
|
94 | + 'error' => $e->getMessage(), |
|
95 | + 'success' => false, |
|
96 | 96 | ], |
97 | - ]); |
|
97 | + ]); |
|
98 | + } |
|
98 | 99 | } |
99 | - } |
|
100 | 100 | |
101 | - private function getMenuByPeople(People $userPeople, People $myCompany) |
|
102 | - { |
|
101 | + private function getMenuByPeople(People $userPeople, People $myCompany) |
|
102 | + { |
|
103 | 103 | |
104 | 104 | $return = []; |
105 | 105 | $connection = $this->manager->getConnection(); |
@@ -136,22 +136,22 @@ discard block |
||
136 | 136 | |
137 | 137 | foreach ($result as $menu) { |
138 | 138 | |
139 | - $return['modules'][$menu['category_id']]['id'] = $menu['category_id']; |
|
140 | - $return['modules'][$menu['category_id']]['label'] = $menu['category_label']; |
|
141 | - $return['modules'][$menu['category_id']]['color'] = $menu['category_color']; |
|
142 | - $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon']; |
|
143 | - $return['modules'][$menu['category_id']]['menus'][] = [ |
|
139 | + $return['modules'][$menu['category_id']]['id'] = $menu['category_id']; |
|
140 | + $return['modules'][$menu['category_id']]['label'] = $menu['category_label']; |
|
141 | + $return['modules'][$menu['category_id']]['color'] = $menu['category_color']; |
|
142 | + $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon']; |
|
143 | + $return['modules'][$menu['category_id']]['menus'][] = [ |
|
144 | 144 | 'id' => $menu['id'], |
145 | 145 | 'label' => $menu['menu'], |
146 | 146 | 'icon' => $menu['icon'], |
147 | 147 | 'color' => $menu['color'], |
148 | 148 | 'route' => $menu['route'], |
149 | 149 | 'module' => '/modules/' . $menu['module'], |
150 | - ]; |
|
150 | + ]; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | 155 | return $return; |
156 | - } |
|
156 | + } |
|
157 | 157 | } |
@@ -9,24 +9,24 @@ |
||
9 | 9 | class WordPressService |
10 | 10 | { |
11 | 11 | |
12 | - public function __construct(private EntityManagerInterface $manager, private RequestStack $requestStack) {} |
|
12 | + public function __construct(private EntityManagerInterface $manager, private RequestStack $requestStack) {} |
|
13 | 13 | |
14 | - public static function getAllPosts($domain, array $input): array |
|
15 | - { |
|
14 | + public static function getAllPosts($domain, array $input): array |
|
15 | + { |
|
16 | 16 | |
17 | 17 | try { |
18 | - $client = new Client(['verify' => false]); |
|
19 | - $response = $client->get($domain . '/wp-json/wp/v2/posts', [ |
|
18 | + $client = new Client(['verify' => false]); |
|
19 | + $response = $client->get($domain . '/wp-json/wp/v2/posts', [ |
|
20 | 20 | 'query' => $input |
21 | - ]); |
|
21 | + ]); |
|
22 | 22 | |
23 | - $result = json_decode($response->getBody()); |
|
23 | + $result = json_decode($response->getBody()); |
|
24 | 24 | |
25 | - return $result; |
|
25 | + return $result; |
|
26 | 26 | } catch (\Exception $e) { |
27 | - print_r($e); |
|
27 | + print_r($e); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return null; |
31 | - } |
|
31 | + } |
|
32 | 32 | } |
@@ -76,7 +76,6 @@ |
||
76 | 76 | * |
77 | 77 | * @ORM\Column(name="visibility", type="string", length=255, nullable=false) |
78 | 78 | * @Groups({"config:read","config:write"}) |
79 | - |
|
80 | 79 | */ |
81 | 80 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['visibility' => 'exact'])] |
82 | 81 |
@@ -66,7 +66,6 @@ |
||
66 | 66 | * |
67 | 67 | * @ORM\Column(name="background", type="integer", nullable=true) |
68 | 68 | * @Groups({"theme:read"}) |
69 | - |
|
70 | 69 | */ |
71 | 70 | private $background; |
72 | 71 | /** |
@@ -19,13 +19,13 @@ |
||
19 | 19 | |
20 | 20 | public function getFileUrl(People $people): ?array |
21 | 21 | { |
22 | - if ($people->getImage() instanceof File) |
|
22 | + if ($people->getImage() instanceof File) |
|
23 | 23 | return [ |
24 | - 'id' => $people->getImage()->getId(), |
|
25 | - 'domain' => $this->domainService->getMainDomain(), |
|
26 | - 'url' => '/files/' . $people->getImage()->getId() . '/download' |
|
24 | + 'id' => $people->getImage()->getId(), |
|
25 | + 'domain' => $this->domainService->getMainDomain(), |
|
26 | + 'url' => '/files/' . $people->getImage()->getId() . '/download' |
|
27 | 27 | ]; |
28 | 28 | |
29 | - return null; |
|
29 | + return null; |
|
30 | 30 | } |
31 | 31 | } |
@@ -51,7 +51,6 @@ |
||
51 | 51 | * |
52 | 52 | * @ORM\Column(name="cod_ibge", type="integer", nullable=true) |
53 | 53 | * @Groups({"city:read","logistic:read","state:read", "order_details:read", "people:read", "address:read", "delivery_region:read"}) |
54 | - |
|
55 | 54 | */ |
56 | 55 | private $cod_ibge; |
57 | 56 | /** |
@@ -59,7 +59,6 @@ |
||
59 | 59 | * |
60 | 60 | * @ORM\Column(name="cod_ibge", type="integer", nullable=true) |
61 | 61 | * @Groups({"city:read","logistic:read","order_details:read","order:write", "people:read", "address:read", "delivery_region:read"}) |
62 | - |
|
63 | 62 | */ |
64 | 63 | private $cod_ibge; |
65 | 64 | /** |