@@ -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); |
@@ -64,8 +64,9 @@ discard block |
||
64 | 64 | $mainCompany = $this->getMainCompany(); |
65 | 65 | |
66 | 66 | $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1); |
67 | - if ($isSuper) |
|
68 | - $peopleRole[] = 'super'; |
|
67 | + if ($isSuper) { |
|
68 | + $peopleRole[] = 'super'; |
|
69 | + } |
|
69 | 70 | |
70 | 71 | $isFranchisee = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'franchisee', 1); |
71 | 72 | if ($isFranchisee) { |
@@ -74,13 +75,15 @@ discard block |
||
74 | 75 | } |
75 | 76 | |
76 | 77 | $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1); |
77 | - if ($isClient) |
|
78 | - $peopleRole[] = 'client'; |
|
78 | + if ($isClient) { |
|
79 | + $peopleRole[] = 'client'; |
|
80 | + } |
|
79 | 81 | |
80 | 82 | |
81 | 83 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1); |
82 | - if ($isSalesman) |
|
83 | - $peopleRole[] = 'salesman'; |
|
84 | + if ($isSalesman) { |
|
85 | + $peopleRole[] = 'salesman'; |
|
86 | + } |
|
84 | 87 | |
85 | 88 | |
86 | 89 | return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole)); |
@@ -96,10 +99,11 @@ discard block |
||
96 | 99 | $domain = $_SERVER['HTTP_HOST']; |
97 | 100 | $company = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
98 | 101 | |
99 | - if ($company === null) |
|
100 | - throw new \Exception( |
|
102 | + if ($company === null) { |
|
103 | + throw new \Exception( |
|
101 | 104 | sprintf('Main company "%s" not found', $domain) |
102 | 105 | ); |
106 | + } |
|
103 | 107 | |
104 | 108 | return $company->getPeople(); |
105 | 109 | } |
@@ -256,12 +256,13 @@ |
||
256 | 256 | |
257 | 257 | private function getLogo(People $company): ?array |
258 | 258 | { |
259 | - if ($company->getFile() instanceof File) |
|
260 | - return [ |
|
259 | + if ($company->getFile() instanceof File) { |
|
260 | + return [ |
|
261 | 261 | 'id' => $company->getFile()->getId(), |
262 | 262 | 'domain' => $_SERVER['HTTP_HOST'], |
263 | 263 | 'url' => '/files/download/' . $company->getFile()->getId() |
264 | 264 | ]; |
265 | + } |
|
265 | 266 | |
266 | 267 | return null; |
267 | 268 | } |