@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @var Request |
| 28 | 28 | */ |
| 29 | - private $request = null; |
|
| 29 | + private $request = null; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Security |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $user = new User(); |
| 111 | 111 | $user->setUsername($payload['username']); |
| 112 | - $user->setHash ($this->encoder->encodePassword($user, $payload['password'])); |
|
| 113 | - $user->setPeople ($company); |
|
| 112 | + $user->setHash($this->encoder->encodePassword($user, $payload['password'])); |
|
| 113 | + $user->setPeople($company); |
|
| 114 | 114 | |
| 115 | 115 | $this->manager->persist($user); |
| 116 | 116 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | throw new \InvalidArgumentException('Deve existir pelo menos um usuário'); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $user = $this->manager->getRepository(User::class)->findOneBy(['id' => $payload['id'], 'people' => $company]); |
|
| 147 | + $user = $this->manager->getRepository(User::class)->findOneBy(['id' => $payload['id'], 'people' => $company]); |
|
| 148 | 148 | if (!$user instanceof User) { |
| 149 | 149 | throw new \InvalidArgumentException('Person user was not found'); |
| 150 | 150 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | private function getUsers(Person $person, ?array $payload = null): array |
| 168 | 168 | { |
| 169 | 169 | $members = []; |
| 170 | - $company = $this->manager->getRepository(People::class )->find($person->getId()); |
|
| 170 | + $company = $this->manager->getRepository(People::class)->find($person->getId()); |
|
| 171 | 171 | $users = $this->manager->getRepository(User::class)->findBy(['people' => $company]); |
| 172 | 172 | |
| 173 | 173 | foreach ($users as $user) { |
@@ -122,8 +122,9 @@ discard block |
||
| 122 | 122 | ]; |
| 123 | 123 | |
| 124 | 124 | } catch (\Exception $e) { |
| 125 | - if ($this->manager->getConnection()->isTransactionActive()) |
|
| 126 | - $this->manager->getConnection()->rollBack(); |
|
| 125 | + if ($this->manager->getConnection()->isTransactionActive()) { |
|
| 126 | + $this->manager->getConnection()->rollBack(); |
|
| 127 | + } |
|
| 127 | 128 | |
| 128 | 129 | throw new \InvalidArgumentException($e->getMessage()); |
| 129 | 130 | } |
@@ -157,8 +158,9 @@ discard block |
||
| 157 | 158 | return true; |
| 158 | 159 | |
| 159 | 160 | } catch (\Exception $e) { |
| 160 | - if ($this->manager->getConnection()->isTransactionActive()) |
|
| 161 | - $this->manager->getConnection()->rollBack(); |
|
| 161 | + if ($this->manager->getConnection()->isTransactionActive()) { |
|
| 162 | + $this->manager->getConnection()->rollBack(); |
|
| 163 | + } |
|
| 162 | 164 | |
| 163 | 165 | throw new \InvalidArgumentException($e->getMessage()); |
| 164 | 166 | } |