@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | private Security $security, |
28 | 28 | private RequestStack $requestStack, |
29 | 29 | ) { |
30 | - $this->request = $requestStack->getCurrentRequest(); |
|
30 | + $this->request = $requestStack->getCurrentRequest(); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function prePersist(People $people) |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function discoveryLink(People $company, People $people, $linkType): PeopleLink |
49 | 49 | { |
50 | - $peopleLink = $this->manager->getRepository(PeopleLink::class)->findOneBy([ |
|
50 | + $peopleLink = $this->manager->getRepository(PeopleLink::class)->findOneBy([ |
|
51 | 51 | 'company' => $company, |
52 | 52 | 'people' => $people, |
53 | 53 | 'link_type' => $linkType |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $phone = $this->getPhone($phone_number['ddi'], $phone_number['ddd'], $phone_number['phone']); |
97 | 97 | if ($phone && $phone->getPeople()) { |
98 | 98 | if ($phone->getPeople()->getId() != $people->getId()) |
99 | - throw new Exception("Phone is in use by people " . $people->getId(), 1); |
|
99 | + throw new Exception("Phone is in use by people ".$people->getId(), 1); |
|
100 | 100 | } else { |
101 | 101 | $phone = new Phone(); |
102 | 102 | $phone->setDdi((int) $phone_number['ddi']); |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | |
110 | 110 | return $phone; |
111 | 111 | } |
112 | - public function addDocument(People $people, string|int $document_number, ?string $document_type = null): Document |
|
112 | + public function addDocument(People $people, string | int $document_number, ?string $document_type = null): Document |
|
113 | 113 | { |
114 | 114 | $document = $this->getDocument($document_number, $document_type); |
115 | 115 | if ($document) { |
116 | 116 | if ($document->getPeople()->getId() != $people->getId()) |
117 | - throw new Exception("Document is in use by people " . $people->getId(), 1); |
|
117 | + throw new Exception("Document is in use by people ".$people->getId(), 1); |
|
118 | 118 | } else { |
119 | 119 | $document_type = $document_type ? $this->discoveryDocumentType($document_type) : $this->discoveryDocumentType($this->getDocumentTypeByDocumentLen($document_number)); |
120 | 120 | $document = new Document(); |
121 | - $document->setDocument((int)$document_number); |
|
121 | + $document->setDocument((int) $document_number); |
|
122 | 122 | $document->setDocumentType($document_type); |
123 | 123 | $document->setPeople($people); |
124 | 124 | $this->manager->persist($document); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $email = $this->getEmail($email_str); |
134 | 134 | if ($email && $email->getPeople()) { |
135 | 135 | if ($email->getPeople()->getId() != $people->getId()) |
136 | - throw new Exception("Email is in use by people " . $people->getId(), 1); |
|
136 | + throw new Exception("Email is in use by people ".$people->getId(), 1); |
|
137 | 137 | } else { |
138 | 138 | $email = new Email(); |
139 | 139 | $email->setEmail($email_str); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | public function discoveryDocumentType(string $document_type): DocumentType |
164 | 164 | { |
165 | - $documentType = $this->manager->getRepository(DocumentType::class)->findOneBy(['documentType' => $document_type]); |
|
165 | + $documentType = $this->manager->getRepository(DocumentType::class)->findOneBy(['documentType' => $document_type]); |
|
166 | 166 | |
167 | 167 | if (!$documentType) { |
168 | 168 | $documentType = new DocumentType(); |
@@ -244,29 +244,29 @@ discard block |
||
244 | 244 | public function checkLink(QueryBuilder $queryBuilder, $resourceClass = null, $applyTo = null, $rootAlias = null): void |
245 | 245 | { |
246 | 246 | |
247 | - $link = $this->request->query->get('link', null); |
|
247 | + $link = $this->request->query->get('link', null); |
|
248 | 248 | $company = $this->request->query->get('company', null); |
249 | 249 | $link_type = $this->request->query->get('link_type', null); |
250 | 250 | |
251 | 251 | if ($link_type) { |
252 | - $queryBuilder->join(sprintf('%s.' . ($link ? 'company' : 'link'), $rootAlias), 'PeopleLink'); |
|
252 | + $queryBuilder->join(sprintf('%s.'.($link ? 'company' : 'link'), $rootAlias), 'PeopleLink'); |
|
253 | 253 | $queryBuilder->andWhere('PeopleLink.link_type IN(:link_type)'); |
254 | 254 | $queryBuilder->setParameter('link_type', $link_type); |
255 | 255 | } |
256 | 256 | |
257 | 257 | if ($company || $link) { |
258 | - $queryBuilder->andWhere('PeopleLink.' . ($link ? 'people' : 'company') . ' IN(:people)'); |
|
258 | + $queryBuilder->andWhere('PeopleLink.'.($link ? 'people' : 'company').' IN(:people)'); |
|
259 | 259 | $queryBuilder->setParameter('people', preg_replace("/[^0-9]/", "", ($link ?: $company))); |
260 | 260 | } |
261 | 261 | } |
262 | 262 | public function checkCompany($type, QueryBuilder $queryBuilder, $resourceClass = null, $applyTo = null, $rootAlias = null): void |
263 | 263 | { |
264 | - $companies = $this->getMyCompanies(); |
|
265 | - $queryBuilder->andWhere(sprintf('%s.' . $type . ' IN(:companies)', $rootAlias, $rootAlias)); |
|
264 | + $companies = $this->getMyCompanies(); |
|
265 | + $queryBuilder->andWhere(sprintf('%s.'.$type.' IN(:companies)', $rootAlias, $rootAlias)); |
|
266 | 266 | $queryBuilder->setParameter('companies', $companies); |
267 | 267 | |
268 | 268 | if ($payer = $this->request->query->get('company', null)) { |
269 | - $queryBuilder->andWhere(sprintf('%s.' . $type . ' IN(:people)', $rootAlias)); |
|
269 | + $queryBuilder->andWhere(sprintf('%s.'.$type.' IN(:people)', $rootAlias)); |
|
270 | 270 | $queryBuilder->setParameter('people', preg_replace("/[^0-9]/", "", $payer)); |
271 | 271 | } |
272 | 272 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | $token = $this->security->getToken(); |
280 | 280 | if (!$token) return []; |
281 | - $currentUser = $token->getUser(); |
|
281 | + $currentUser = $token->getUser(); |
|
282 | 282 | $companies = []; |
283 | 283 | if (!$currentUser) return []; |
284 | 284 |