@@ -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['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->setDdd((int) $phone_number['ddd']); |
@@ -108,16 +108,16 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | return $phone; |
| 110 | 110 | } |
| 111 | - public function addDocument(People $people, string|int $document_number, ?string $document_type = null): Document |
|
| 111 | + public function addDocument(People $people, string | int $document_number, ?string $document_type = null): Document |
|
| 112 | 112 | { |
| 113 | 113 | $document = $this->getDocument($document_number, $document_type); |
| 114 | 114 | if ($document) { |
| 115 | 115 | if ($document->getPeople()->getId() != $people->getId()) |
| 116 | - throw new Exception("Document is in use by people " . $people->getId(), 1); |
|
| 116 | + throw new Exception("Document is in use by people ".$people->getId(), 1); |
|
| 117 | 117 | } else { |
| 118 | 118 | $document_type = $document_type ? $this->discoveryDocumentType($document_type) : $this->discoveryDocumentType($this->getDocumentTypeByDocumentLen($document_number)); |
| 119 | 119 | $document = new Document(); |
| 120 | - $document->setDocument((int)$document_number); |
|
| 120 | + $document->setDocument((int) $document_number); |
|
| 121 | 121 | $document->setDocumentType($document_type); |
| 122 | 122 | $document->setPeople($people); |
| 123 | 123 | $this->manager->persist($document); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $email = $this->getEmail($email_str); |
| 133 | 133 | if ($email && $email->getPeople()) { |
| 134 | 134 | if ($email->getPeople()->getId() != $people->getId()) |
| 135 | - throw new Exception("Email is in use by people " . $people->getId(), 1); |
|
| 135 | + throw new Exception("Email is in use by people ".$people->getId(), 1); |
|
| 136 | 136 | } else { |
| 137 | 137 | $email = new Email(); |
| 138 | 138 | $email->setEmail($email_str); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | public function discoveryDocumentType(string $document_type): DocumentType |
| 159 | 159 | { |
| 160 | - $documentType = $this->manager->getRepository(DocumentType::class)->findOneBy(['documentType' => $document_type]); |
|
| 160 | + $documentType = $this->manager->getRepository(DocumentType::class)->findOneBy(['documentType' => $document_type]); |
|
| 161 | 161 | |
| 162 | 162 | if (!$documentType) { |
| 163 | 163 | $documentType = new DocumentType(); |
@@ -239,29 +239,29 @@ discard block |
||
| 239 | 239 | public function checkLink(QueryBuilder $queryBuilder, $resourceClass = null, $applyTo = null, $rootAlias = null): void |
| 240 | 240 | { |
| 241 | 241 | |
| 242 | - $link = $this->request->query->get('link', null); |
|
| 242 | + $link = $this->request->query->get('link', null); |
|
| 243 | 243 | $company = $this->request->query->get('company', null); |
| 244 | 244 | $link_type = $this->request->query->get('link_type', null); |
| 245 | 245 | |
| 246 | 246 | if ($link_type) { |
| 247 | - $queryBuilder->join(sprintf('%s.' . ($link ? 'company' : 'link'), $rootAlias), 'PeopleLink'); |
|
| 247 | + $queryBuilder->join(sprintf('%s.'.($link ? 'company' : 'link'), $rootAlias), 'PeopleLink'); |
|
| 248 | 248 | $queryBuilder->andWhere('PeopleLink.link_type IN(:link_type)'); |
| 249 | 249 | $queryBuilder->setParameter('link_type', $link_type); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | if ($company || $link) { |
| 253 | - $queryBuilder->andWhere('PeopleLink.' . ($link ? 'people' : 'company') . ' IN(:people)'); |
|
| 253 | + $queryBuilder->andWhere('PeopleLink.'.($link ? 'people' : 'company').' IN(:people)'); |
|
| 254 | 254 | $queryBuilder->setParameter('people', preg_replace("/[^0-9]/", "", ($link ?: $company))); |
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | public function checkCompany($type, QueryBuilder $queryBuilder, $resourceClass = null, $applyTo = null, $rootAlias = null): void |
| 258 | 258 | { |
| 259 | - $companies = $this->getMyCompanies(); |
|
| 260 | - $queryBuilder->andWhere(sprintf('%s.' . $type . ' IN(:companies)', $rootAlias, $rootAlias)); |
|
| 259 | + $companies = $this->getMyCompanies(); |
|
| 260 | + $queryBuilder->andWhere(sprintf('%s.'.$type.' IN(:companies)', $rootAlias, $rootAlias)); |
|
| 261 | 261 | $queryBuilder->setParameter('companies', $companies); |
| 262 | 262 | |
| 263 | 263 | if ($payer = $this->request->query->get('company', null)) { |
| 264 | - $queryBuilder->andWhere(sprintf('%s.' . $type . ' IN(:people)', $rootAlias)); |
|
| 264 | + $queryBuilder->andWhere(sprintf('%s.'.$type.' IN(:people)', $rootAlias)); |
|
| 265 | 265 | $queryBuilder->setParameter('people', preg_replace("/[^0-9]/", "", $payer)); |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | $token = $this->security->getToken(); |
| 275 | 275 | if (!$token) return []; |
| 276 | - $currentUser = $token->getUser(); |
|
| 276 | + $currentUser = $token->getUser(); |
|
| 277 | 277 | $companies = []; |
| 278 | 278 | if (!$currentUser) return []; |
| 279 | 279 | |