@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $globalSql = $this->synchronizer->getCreateSchema($global); |
| 78 | 78 | if ($globalSql) { |
| 79 | 79 | $sql[] = "-- Create Root Federation\n" . |
| 80 | - "USE FEDERATION ROOT WITH RESET;"; |
|
| 80 | + "USE FEDERATION ROOT WITH RESET;"; |
|
| 81 | 81 | $sql = array_merge($sql, $globalSql); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $federationSql = $this->synchronizer->getDropAllSchema(); |
| 159 | 159 | if ($federationSql) { |
| 160 | 160 | $sql[] = "-- Work on Federation ID " . $shard['id'] . "\n" . |
| 161 | - "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'].") WITH RESET, FILTERING = OFF;"; |
|
| 161 | + "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'].") WITH RESET, FILTERING = OFF;"; |
|
| 162 | 162 | $sql = array_merge($sql, $federationSql); |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $federationSql = $operation($this->synchronizer, $federation); |
| 254 | 254 | if ($federationSql) { |
| 255 | 255 | $sql[] = "-- Work on Federation ID " . $shard['id'] . "\n" . |
| 256 | - "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'].") WITH RESET, FILTERING = OFF;"; |
|
| 256 | + "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'].") WITH RESET, FILTERING = OFF;"; |
|
| 257 | 257 | $sql = array_merge($sql, $federationSql); |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -294,6 +294,6 @@ discard block |
||
| 294 | 294 | $federationTypeSql = $federationType->getSQLDeclaration([], $this->conn->getDatabasePlatform()); |
| 295 | 295 | |
| 296 | 296 | return "--Create Federation\n" . |
| 297 | - "CREATE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " " . $federationTypeSql ." RANGE)"; |
|
| 297 | + "CREATE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " " . $federationTypeSql ." RANGE)"; |
|
| 298 | 298 | } |
| 299 | 299 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function getUpdateSchema(Schema $toSchema, $noDrops = false) |
| 101 | 101 | { |
| 102 | - return $this->work($toSchema, function ($synchronizer, $schema) use ($noDrops) { |
|
| 102 | + return $this->work($toSchema, function($synchronizer, $schema) use ($noDrops) { |
|
| 103 | 103 | return $synchronizer->getUpdateSchema($schema, $noDrops); |
| 104 | 104 | }); |
| 105 | 105 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function getDropSchema(Schema $dropSchema) |
| 111 | 111 | { |
| 112 | - return $this->work($dropSchema, function ($synchronizer, $schema) { |
|
| 112 | + return $this->work($dropSchema, function($synchronizer, $schema) { |
|
| 113 | 113 | return $synchronizer->getDropSchema($schema); |
| 114 | 114 | }); |
| 115 | 115 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $federationSql = $this->synchronizer->getDropAllSchema(); |
| 159 | 159 | if ($federationSql) { |
| 160 | 160 | $sql[] = "-- Work on Federation ID " . $shard['id'] . "\n" . |
| 161 | - "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'].") WITH RESET, FILTERING = OFF;"; |
|
| 161 | + "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'] . ") WITH RESET, FILTERING = OFF;"; |
|
| 162 | 162 | $sql = array_merge($sql, $federationSql); |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $federationSql = $operation($this->synchronizer, $federation); |
| 254 | 254 | if ($federationSql) { |
| 255 | 255 | $sql[] = "-- Work on Federation ID " . $shard['id'] . "\n" . |
| 256 | - "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'].") WITH RESET, FILTERING = OFF;"; |
|
| 256 | + "USE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " = " . $shard['rangeLow'] . ") WITH RESET, FILTERING = OFF;"; |
|
| 257 | 257 | $sql = array_merge($sql, $federationSql); |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -294,6 +294,6 @@ discard block |
||
| 294 | 294 | $federationTypeSql = $federationType->getSQLDeclaration([], $this->conn->getDatabasePlatform()); |
| 295 | 295 | |
| 296 | 296 | return "--Create Federation\n" . |
| 297 | - "CREATE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " " . $federationTypeSql ." RANGE)"; |
|
| 297 | + "CREATE FEDERATION " . $this->shardManager->getFederationName() . " (" . $this->shardManager->getDistributionKey() . " " . $federationTypeSql . " RANGE)"; |
|
| 298 | 298 | } |
| 299 | 299 | } |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | return $this->conn->fetchAll($sql); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - /** |
|
| 202 | - * {@inheritDoc} |
|
| 203 | - */ |
|
| 201 | + /** |
|
| 202 | + * {@inheritDoc} |
|
| 203 | + */ |
|
| 204 | 204 | public function queryAll($sql, array $params = [], array $types = []) |
| 205 | 205 | { |
| 206 | 206 | $shards = $this->getShards(); |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | $type = Type::getType($this->distributionType); |
| 240 | 240 | |
| 241 | 241 | $sql = "ALTER FEDERATION " . $this->getFederationName() . " " . |
| 242 | - "SPLIT AT (" . $this->getDistributionKey() . " = " . |
|
| 243 | - $this->conn->quote($splitDistributionValue, $type->getBindingType()) . ")"; |
|
| 242 | + "SPLIT AT (" . $this->getDistributionKey() . " = " . |
|
| 243 | + $this->conn->quote($splitDistributionValue, $type->getBindingType()) . ")"; |
|
| 244 | 244 | $this->conn->exec($sql); |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | throw ShardingException::activeTransaction(); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if ($distributionValue === null || is_bool($distributionValue) || !is_scalar($distributionValue)) { |
|
| 160 | + if ($distributionValue === null || is_bool($distributionValue) || ! is_scalar($distributionValue)) { |
|
| 161 | 161 | throw ShardingException::noShardDistributionValue(); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | public function queryAll($sql, array $params = [], array $types = []) |
| 205 | 205 | { |
| 206 | 206 | $shards = $this->getShards(); |
| 207 | - if (!$shards) { |
|
| 207 | + if ( ! $shards) { |
|
| 208 | 208 | throw new \RuntimeException("No shards found for " . $this->federationName); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $table->addColumn($this->tenantColumnName, $this->tenantColumnType, [ |
| 99 | - 'default' => "federation_filtering_value('". $this->distributionName ."')", |
|
| 99 | + 'default' => "federation_filtering_value('" . $this->distributionName . "')", |
|
| 100 | 100 | ]); |
| 101 | 101 | |
| 102 | 102 | $clusteredIndex = $this->getClusteredIndex($table); |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null) |
| 94 | 94 | { |
| 95 | - if ( !isset($params['global']) || !isset($params['shards'])) { |
|
| 95 | + if ( ! isset($params['global']) || ! isset($params['shards'])) { |
|
| 96 | 96 | throw new \InvalidArgumentException("Connection Parameters require 'global' and 'shards' configurations."); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if ( !isset($params['shardChoser'])) { |
|
| 99 | + if ( ! isset($params['shardChoser'])) { |
|
| 100 | 100 | throw new \InvalidArgumentException("Missing Shard Choser configuration 'shardChoser'"); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | throw new \InvalidArgumentException("Missing 'id' for one configured shard. Please specify a unique shard-id."); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( !is_numeric($shard['id']) || $shard['id'] < 1) { |
|
| 118 | + if ( ! is_numeric($shard['id']) || $shard['id'] < 1) { |
|
| 119 | 119 | throw new \InvalidArgumentException("Shard Id has to be a non-negative number."); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | $types = $this->extractTypeValues($columns, $types); |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | - $sql = 'UPDATE ' . $tableExpression . ' SET ' . implode(', ', $set) |
|
| 761 | + $sql = 'UPDATE ' . $tableExpression . ' SET ' . implode(', ', $set) |
|
| 762 | 762 | . ' WHERE ' . implode(' AND ', $conditions); |
| 763 | 763 | |
| 764 | 764 | return $this->executeUpdate($sql, $values, $types); |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | } |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | - if (!isset($stmt)) { |
|
| 981 | + if ( ! isset($stmt)) { |
|
| 982 | 982 | $stmt = new ResultCacheStatement($this->executeQuery($query, $params, $types), $resultCache, $cacheKey, $realKey, $qcp->getLifetime()); |
| 983 | 983 | } |
| 984 | 984 | |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | */ |
| 1251 | 1251 | protected function _getNestedTransactionSavePointName() |
| 1252 | 1252 | { |
| 1253 | - return 'DOCTRINE2_SAVEPOINT_'.$this->_transactionNestingLevel; |
|
| 1253 | + return 'DOCTRINE2_SAVEPOINT_' . $this->_transactionNestingLevel; |
|
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | /** |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function __construct($table, AbstractPlatform $platform) |
| 57 | 57 | { |
| 58 | - if ( ! $table instanceof Table && !is_string($table)) { |
|
| 58 | + if ( ! $table instanceof Table && ! is_string($table)) { |
|
| 59 | 59 | throw new \InvalidArgumentException('SchemaDropTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -66,8 +66,8 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | public function postConnect(ConnectionEventArgs $args) |
| 68 | 68 | { |
| 69 | - $collation = ($this->_collation) ? " COLLATE ".$this->_collation : ""; |
|
| 70 | - $args->getConnection()->executeUpdate("SET NAMES ".$this->_charset . $collation); |
|
| 69 | + $collation = ($this->_collation) ? " COLLATE " . $this->_collation : ""; |
|
| 70 | + $args->getConnection()->executeUpdate("SET NAMES " . $this->_charset . $collation); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | $vars[] = $option . " = '" . $value . "'"; |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | - $sql = "ALTER SESSION SET ".implode(" ", $vars); |
|
| 82 | + $sql = "ALTER SESSION SET " . implode(" ", $vars); |
|
| 83 | 83 | $args->getConnection()->executeUpdate($sql); |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -143,8 +143,8 @@ |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $sql = "UPDATE " . $this->generatorTableName . " ". |
| 146 | - "SET sequence_value = sequence_value + sequence_increment_by " . |
|
| 147 | - "WHERE sequence_name = ? AND sequence_value = ?"; |
|
| 146 | + "SET sequence_value = sequence_value + sequence_increment_by " . |
|
| 147 | + "WHERE sequence_name = ? AND sequence_value = ?"; |
|
| 148 | 148 | $rows = $this->conn->executeUpdate($sql, [$sequenceName, $row['sequence_value']]); |
| 149 | 149 | |
| 150 | 150 | if ($rows != 1) { |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | ]; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $sql = "UPDATE " . $this->generatorTableName . " ". |
|
| 145 | + $sql = "UPDATE " . $this->generatorTableName . " " . |
|
| 146 | 146 | "SET sequence_value = sequence_value + sequence_increment_by " . |
| 147 | 147 | "WHERE sequence_name = ? AND sequence_value = ?"; |
| 148 | 148 | $rows = $this->conn->executeUpdate($sql, [$sequenceName, $row['sequence_value']]); |