@@ -27,8 +27,9 @@ discard block |
||
27 | 27 | public function __construct(Connection $connection) |
28 | 28 | { |
29 | 29 | $this->connection = $connection; |
30 | - if (!self::$originalDbParams) |
|
31 | - self::$originalDbParams = $connection->getParams(); |
|
30 | + if (!self::$originalDbParams) { |
|
31 | + self::$originalDbParams = $connection->getParams(); |
|
32 | + } |
|
32 | 33 | } |
33 | 34 | |
34 | 35 | /* @param string $domain |
@@ -54,8 +55,9 @@ discard block |
||
54 | 55 | */ |
55 | 56 | private function switchDatabase($dbData) |
56 | 57 | { |
57 | - if ($this->connection->isConnected()) |
|
58 | - $this->connection->close(); |
|
58 | + if ($this->connection->isConnected()) { |
|
59 | + $this->connection->close(); |
|
60 | + } |
|
59 | 61 | |
60 | 62 | $this->connection->__construct( |
61 | 63 | $dbData, |
@@ -178,8 +180,9 @@ discard block |
||
178 | 180 | ) |
179 | 181 | )); |
180 | 182 | |
181 | - if (!$domain) |
|
182 | - throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
183 | + if (!$domain) { |
|
184 | + throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
185 | + } |
|
183 | 186 | return $domain; |
184 | 187 | } |
185 | 188 | } |
@@ -21,10 +21,11 @@ |
||
21 | 21 | public function onKernelRequest(RequestEvent $event) |
22 | 22 | { |
23 | 23 | try { |
24 | - if (!self::$tenency_params) |
|
25 | - self::$tenency_params = $this->databaseSwitchService->switchDatabaseByDomain( |
|
24 | + if (!self::$tenency_params) { |
|
25 | + self::$tenency_params = $this->databaseSwitchService->switchDatabaseByDomain( |
|
26 | 26 | $this->databaseSwitchService->getDomain($event->getRequest()) |
27 | 27 | ); |
28 | + } |
|
28 | 29 | } catch (Exception $e) { |
29 | 30 | throw new Exception(sprintf('%s', $e), 1); |
30 | 31 | } |
@@ -42,8 +42,9 @@ |
||
42 | 42 | protected function execute(InputInterface $input, OutputInterface $output) |
43 | 43 | { |
44 | 44 | $domain = $input->getArgument('domain'); |
45 | - if ($domain) |
|
46 | - return $this->migrateByDomain($domain, $input, $output); |
|
45 | + if ($domain) { |
|
46 | + return $this->migrateByDomain($domain, $input, $output); |
|
47 | + } |
|
47 | 48 | |
48 | 49 | $domains = $this->databaseSwitchService->getAllDomains(); |
49 | 50 |