@@ -125,15 +125,16 @@ |
||
125 | 125 | |
126 | 126 | private function log() |
127 | 127 | { |
128 | - if (get_class($this->entity) == 'ControleOnline\Entity\Webapi\Usuario') |
|
129 | - $this->user = $this->entity; |
|
130 | - else |
|
131 | - $this->log[] = |
|
128 | + if (get_class($this->entity) == 'ControleOnline\Entity\Webapi\Usuario') { |
|
129 | + $this->user = $this->entity; |
|
130 | + } else { |
|
131 | + $this->log[] = |
|
132 | 132 | [ |
133 | 133 | 'action' => $this->action, |
134 | 134 | 'class' => str_replace('Proxies\\__CG__\\', '', get_class($this->entity)), |
135 | 135 | 'object' => $this->getObject($this->entity) |
136 | 136 | ]; |
137 | + } |
|
137 | 138 | } |
138 | 139 | |
139 | 140 | private function getObject($entity) |
@@ -89,11 +89,13 @@ |
||
89 | 89 | private function getMembers($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = []) |
90 | 90 | { |
91 | 91 | |
92 | - if ($limit < 1) |
|
93 | - $limit = $this->request->get('itemsPerPage') ?: 50; |
|
92 | + if ($limit < 1) { |
|
93 | + $limit = $this->request->get('itemsPerPage') ?: 50; |
|
94 | + } |
|
94 | 95 | |
95 | - if ($page == 1) |
|
96 | - $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; |
|
96 | + if ($page == 1) { |
|
97 | + $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; |
|
98 | + } |
|
97 | 99 | |
98 | 100 | $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
99 | 101 |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | ->getResult() |
44 | 44 | ; |
45 | 45 | |
46 | - if (empty($result)) |
|
47 | - return null; |
|
46 | + if (empty($result)) { |
|
47 | + return null; |
|
48 | + } |
|
48 | 49 | |
49 | 50 | return $result[0]; |
50 | 51 | } |
@@ -78,8 +79,9 @@ discard block |
||
78 | 79 | ->getResult() |
79 | 80 | ; |
80 | 81 | |
81 | - if (empty($result)) |
|
82 | - return null; |
|
82 | + if (empty($result)) { |
|
83 | + return null; |
|
84 | + } |
|
83 | 85 | |
84 | 86 | return $result[0]; |
85 | 87 | } |
@@ -56,15 +56,17 @@ |
||
56 | 56 | |
57 | 57 | $company = $request->query->get('myCompany', null); |
58 | 58 | |
59 | - if ($company === null) |
|
60 | - throw new Exception("Company not found", 404); |
|
59 | + if ($company === null) { |
|
60 | + throw new Exception("Company not found", 404); |
|
61 | + } |
|
61 | 62 | |
62 | 63 | |
63 | 64 | $myCompany = $this->manager->getRepository(People::class) |
64 | 65 | ->find($company); |
65 | 66 | |
66 | - if ($myCompany === null) |
|
67 | - throw new Exception("Company not found", 404); |
|
67 | + if ($myCompany === null) { |
|
68 | + throw new Exception("Company not found", 404); |
|
69 | + } |
|
68 | 70 | |
69 | 71 | |
70 | 72 |
@@ -56,15 +56,17 @@ |
||
56 | 56 | |
57 | 57 | $company = $request->query->get('myCompany', null); |
58 | 58 | |
59 | - if ($company === null) |
|
60 | - throw new Exception("Company not found", 404); |
|
59 | + if ($company === null) { |
|
60 | + throw new Exception("Company not found", 404); |
|
61 | + } |
|
61 | 62 | |
62 | 63 | |
63 | 64 | $myCompany = $this->manager->getRepository(People::class) |
64 | 65 | ->find($company); |
65 | 66 | |
66 | - if ($myCompany === null) |
|
67 | - throw new Exception("Company not found", 404); |
|
67 | + if ($myCompany === null) { |
|
68 | + throw new Exception("Company not found", 404); |
|
69 | + } |
|
68 | 70 | |
69 | 71 | |
70 | 72 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | $service = $this->container->get($serviceName); |
52 | 52 | if (method_exists($service, $method)) { |
53 | 53 | $entity = $service->$method($entity); |
54 | - if ('afterPersist' === $method && $entity) |
|
55 | - $this->manager->refresh($entity); |
|
54 | + if ('afterPersist' === $method && $entity) { |
|
55 | + $this->manager->refresh($entity); |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | } |
58 | 59 | } |
@@ -38,8 +38,9 @@ |
||
38 | 38 | ) |
39 | 39 | )); |
40 | 40 | |
41 | - if (!$domain) |
|
42 | - throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
41 | + if (!$domain) { |
|
42 | + throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
43 | + } |
|
43 | 44 | return $domain; |
44 | 45 | } |
45 | 46 |
@@ -64,8 +64,9 @@ discard block |
||
64 | 64 | ->getQuery() |
65 | 65 | ->getResult(); |
66 | 66 | |
67 | - if (empty($result)) |
|
68 | - return null; |
|
67 | + if (empty($result)) { |
|
68 | + return null; |
|
69 | + } |
|
69 | 70 | |
70 | 71 | $configs = []; |
71 | 72 | |
@@ -88,8 +89,9 @@ discard block |
||
88 | 89 | ]); |
89 | 90 | |
90 | 91 | |
91 | - if (empty($config) || $config->getConfigValue() != 'itau') |
|
92 | - return null; |
|
92 | + if (empty($config) || $config->getConfigValue() != 'itau') { |
|
93 | + return null; |
|
94 | + } |
|
93 | 95 | |
94 | 96 | $result = $this->createQueryBuilder('a') |
95 | 97 | ->andWhere('a.people = :people') |
@@ -99,8 +101,9 @@ discard block |
||
99 | 101 | ->getQuery() |
100 | 102 | ->getResult(); |
101 | 103 | |
102 | - if (empty($result)) |
|
103 | - return null; |
|
104 | + if (empty($result)) { |
|
105 | + return null; |
|
106 | + } |
|
104 | 107 | |
105 | 108 | $configs = []; |
106 | 109 | |
@@ -125,8 +128,9 @@ discard block |
||
125 | 128 | ->getQuery() |
126 | 129 | ->getResult(); |
127 | 130 | |
128 | - if (empty($result)) |
|
129 | - return null; |
|
131 | + if (empty($result)) { |
|
132 | + return null; |
|
133 | + } |
|
130 | 134 | |
131 | 135 | $configs = []; |
132 | 136 |
@@ -24,15 +24,17 @@ discard block |
||
24 | 24 | } |
25 | 25 | public function persist($entity) |
26 | 26 | { |
27 | - if (self::$persisted == true) |
|
28 | - return; |
|
27 | + if (self::$persisted == true) { |
|
28 | + return; |
|
29 | + } |
|
29 | 30 | self::$persisted = true; |
30 | 31 | |
31 | 32 | $json = json_decode($this->request->getContent(), true); |
32 | 33 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
33 | 34 | |
34 | - if (!$extra_data) |
|
35 | - return; |
|
35 | + if (!$extra_data) { |
|
36 | + return; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | //$this->manager->persist($entity); |
38 | 40 | //$this->manager->flush(); |
@@ -43,13 +45,15 @@ discard block |
||
43 | 45 | } |
44 | 46 | private function persistData($entity_id, $entity_name) |
45 | 47 | { |
46 | - if (!$entity_id || !$entity_name) |
|
47 | - return; |
|
48 | + if (!$entity_id || !$entity_name) { |
|
49 | + return; |
|
50 | + } |
|
48 | 51 | $json = json_decode($this->request->getContent(), true); |
49 | 52 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
50 | 53 | |
51 | - if (!$extra_data) |
|
52 | - return; |
|
54 | + if (!$extra_data) { |
|
55 | + return; |
|
56 | + } |
|
53 | 57 | |
54 | 58 | |
55 | 59 | foreach ($extra_data['data'] as $key => $data) { |
@@ -61,8 +65,9 @@ discard block |
||
61 | 65 | 'extra_fields' => $extra_fields |
62 | 66 | ]); |
63 | 67 | |
64 | - if (!$extraData) |
|
65 | - $extraData = new ExtraData(); |
|
68 | + if (!$extraData) { |
|
69 | + $extraData = new ExtraData(); |
|
70 | + } |
|
66 | 71 | |
67 | 72 | $extraData->setExtraFields($extra_fields); |
68 | 73 | $extraData->setEntityName($entity_name); |
@@ -77,13 +82,15 @@ discard block |
||
77 | 82 | |
78 | 83 | public function noChange() |
79 | 84 | { |
80 | - if (self::$persisted == true) |
|
81 | - return; |
|
85 | + if (self::$persisted == true) { |
|
86 | + return; |
|
87 | + } |
|
82 | 88 | self::$persisted = true; |
83 | 89 | $json = json_decode($this->request->getContent(), true); |
84 | 90 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
85 | - if (!$extra_data) |
|
86 | - return; |
|
91 | + if (!$extra_data) { |
|
92 | + return; |
|
93 | + } |
|
87 | 94 | |
88 | 95 | $this->persistData($extra_data['entity_id'], $extra_data['entity_name']); |
89 | 96 | } |