@@ -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); |
@@ -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 | } |
@@ -45,8 +45,9 @@ |
||
45 | 45 | 'link_type' => $link_type |
46 | 46 | ]); |
47 | 47 | |
48 | - if (!$peopleLink) |
|
49 | - $peopleLink = new PeopleLink(); |
|
48 | + if (!$peopleLink) { |
|
49 | + $peopleLink = new PeopleLink(); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | $peopleLink->setCompany($company); |
52 | 53 | $peopleLink->setPeople($people); |
@@ -60,7 +60,9 @@ discard block |
||
60 | 60 | */ |
61 | 61 | foreach ($getPeopleCompanies as $peopleCompany) { |
62 | 62 | $isFranchisee = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'franchisee', 1); |
63 | - if ($isFranchisee) return true; |
|
63 | + if ($isFranchisee) { |
|
64 | + return true; |
|
65 | + } |
|
64 | 66 | } |
65 | 67 | return $isFranchisee; |
66 | 68 | } |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | $isSalesman = false; |
78 | 80 | |
79 | 81 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1); |
80 | - if ($isSalesman) return true; |
|
82 | + if ($isSalesman) { |
|
83 | + return true; |
|
84 | + } |
|
81 | 85 | |
82 | 86 | $getPeopleCompanies = $this->manager->getRepository(PeopleLink::class)->findBy([ |
83 | 87 | 'people' => $people, |
@@ -88,7 +92,9 @@ discard block |
||
88 | 92 | */ |
89 | 93 | foreach ($getPeopleCompanies as $peopleCompany) { |
90 | 94 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'salesman', 1); |
91 | - if ($isSalesman) return true; |
|
95 | + if ($isSalesman) { |
|
96 | + return true; |
|
97 | + } |
|
92 | 98 | } |
93 | 99 | return $isSalesman; |
94 | 100 | } |
@@ -101,8 +107,9 @@ discard block |
||
101 | 107 | $mainCompany = $this->getMainCompany(); |
102 | 108 | |
103 | 109 | $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1); |
104 | - if ($isSuper) |
|
105 | - $peopleRole[] = 'super'; |
|
110 | + if ($isSuper) { |
|
111 | + $peopleRole[] = 'super'; |
|
112 | + } |
|
106 | 113 | |
107 | 114 | |
108 | 115 | |
@@ -113,13 +120,15 @@ discard block |
||
113 | 120 | } |
114 | 121 | |
115 | 122 | $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1); |
116 | - if ($isClient) |
|
117 | - $peopleRole[] = 'client'; |
|
123 | + if ($isClient) { |
|
124 | + $peopleRole[] = 'client'; |
|
125 | + } |
|
118 | 126 | |
119 | 127 | |
120 | 128 | $isSalesman = $this->isSalesman($user); |
121 | - if ($isSalesman) |
|
122 | - $peopleRole[] = 'salesman'; |
|
129 | + if ($isSalesman) { |
|
130 | + $peopleRole[] = 'salesman'; |
|
131 | + } |
|
123 | 132 | |
124 | 133 | |
125 | 134 | return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole)); |
@@ -135,10 +144,11 @@ discard block |
||
135 | 144 | $domain = $this->domainService->getMainDomain(); |
136 | 145 | $company = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
137 | 146 | |
138 | - if ($company === null) |
|
139 | - throw new \Exception( |
|
147 | + if ($company === null) { |
|
148 | + throw new \Exception( |
|
140 | 149 | sprintf('Main company "%s" not found', $domain) |
141 | 150 | ); |
151 | + } |
|
142 | 152 | |
143 | 153 | return $company->getPeople(); |
144 | 154 | } |