@@ -119,8 +119,9 @@ |
||
| 119 | 119 | 'id' => $user->getId() |
| 120 | 120 | ]; |
| 121 | 121 | } catch (\Exception $e) { |
| 122 | - if ($this->manager->getConnection()->isTransactionActive()) |
|
| 123 | - $this->manager->getConnection()->rollBack(); |
|
| 122 | + if ($this->manager->getConnection()->isTransactionActive()) { |
|
| 123 | + $this->manager->getConnection()->rollBack(); |
|
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | throw new \InvalidArgumentException($e->getMessage()); |
| 126 | 127 | } |
@@ -113,8 +113,9 @@ |
||
| 113 | 113 | |
| 114 | 114 | return true; |
| 115 | 115 | } catch (\Exception $e) { |
| 116 | - if ($this->manager->getConnection()->isTransactionActive()) |
|
| 117 | - $this->manager->getConnection()->rollBack(); |
|
| 116 | + if ($this->manager->getConnection()->isTransactionActive()) { |
|
| 117 | + $this->manager->getConnection()->rollBack(); |
|
| 118 | + } |
|
| 118 | 119 | |
| 119 | 120 | throw new \InvalidArgumentException($e->getMessage()); |
| 120 | 121 | } |
@@ -51,8 +51,9 @@ |
||
| 51 | 51 | ->setParameter('company', $company->getId()) |
| 52 | 52 | ->setParameter('people', $people->getId()); |
| 53 | 53 | |
| 54 | - if ($linkType) |
|
| 55 | - $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType'); |
|
| 54 | + if ($linkType) { |
|
| 55 | + $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType'); |
|
| 56 | + } |
|
| 56 | 57 | |
| 57 | 58 | if ($maxResults) { |
| 58 | 59 | $queryBuilder->setMaxResults($maxResults); |
@@ -66,8 +66,9 @@ discard block |
||
| 66 | 66 | $mainCompany = $this->getMainCompany(); |
| 67 | 67 | |
| 68 | 68 | $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1); |
| 69 | - if ($isSuper) |
|
| 70 | - $peopleRole[] = 'super'; |
|
| 69 | + if ($isSuper) { |
|
| 70 | + $peopleRole[] = 'super'; |
|
| 71 | + } |
|
| 71 | 72 | |
| 72 | 73 | $isFranchisee = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'franchisee', 1); |
| 73 | 74 | if ($isFranchisee) { |
@@ -76,13 +77,15 @@ discard block |
||
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1); |
| 79 | - if ($isClient) |
|
| 80 | - $peopleRole[] = 'client'; |
|
| 80 | + if ($isClient) { |
|
| 81 | + $peopleRole[] = 'client'; |
|
| 82 | + } |
|
| 81 | 83 | |
| 82 | 84 | |
| 83 | 85 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1); |
| 84 | - if ($isSalesman) |
|
| 85 | - $peopleRole[] = 'salesman'; |
|
| 86 | + if ($isSalesman) { |
|
| 87 | + $peopleRole[] = 'salesman'; |
|
| 88 | + } |
|
| 86 | 89 | |
| 87 | 90 | |
| 88 | 91 | return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole)); |
@@ -98,10 +101,11 @@ discard block |
||
| 98 | 101 | $domain = $this->domainService->getMainDomain(); |
| 99 | 102 | $company = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
| 100 | 103 | |
| 101 | - if ($company === null) |
|
| 102 | - throw new \Exception( |
|
| 104 | + if ($company === null) { |
|
| 105 | + throw new \Exception( |
|
| 103 | 106 | sprintf('Main company "%s" not found', $domain) |
| 104 | 107 | ); |
| 108 | + } |
|
| 105 | 109 | |
| 106 | 110 | return $company->getPeople(); |
| 107 | 111 | } |
@@ -260,12 +260,13 @@ |
||
| 260 | 260 | |
| 261 | 261 | private function getLogo(People $company): ?array |
| 262 | 262 | { |
| 263 | - if ($company->getFile() instanceof File) |
|
| 264 | - return [ |
|
| 263 | + if ($company->getFile() instanceof File) { |
|
| 264 | + return [ |
|
| 265 | 265 | 'id' => $company->getFile()->getId(), |
| 266 | 266 | 'domain' => $this->domainService->getMainDomain(), |
| 267 | 267 | 'url' => '/files/download/' . $company->getFile()->getId() |
| 268 | 268 | ]; |
| 269 | + } |
|
| 269 | 270 | |
| 270 | 271 | return null; |
| 271 | 272 | } |