@@ -207,7 +207,7 @@ |
||
| 207 | 207 | if (strlen($alias) <= 30) { // Older oracle version had a limit of 30 characters for identifiers |
| 208 | 208 | return $alias; |
| 209 | 209 | } |
| 210 | - return substr($columnName, 0, 20) . crc32($tableName.'____'.$columnName); |
|
| 210 | + return substr($columnName, 0, 20).crc32($tableName.'____'.$columnName); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | abstract protected function compute(): void; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function createResultIterator(QueryFactory $queryFactory, array $parameters, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, int $mode, LoggerInterface $logger): self |
| 86 | 86 | { |
| 87 | - $iterator = new static(); |
|
| 87 | + $iterator = new static(); |
|
| 88 | 88 | if ($mode !== TDBMService::MODE_CURSOR && $mode !== TDBMService::MODE_ARRAY) { |
| 89 | 89 | throw new TDBMException("Unknown fetch mode: '".$mode."'"); |
| 90 | 90 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | public function jsonSerialize($stopRecursion = false) |
| 283 | 283 | { |
| 284 | - return array_map(function (AbstractTDBMObject $item) use ($stopRecursion) { |
|
| 284 | + return array_map(function(AbstractTDBMObject $item) use ($stopRecursion) { |
|
| 285 | 285 | return $item->jsonSerialize($stopRecursion); |
| 286 | 286 | }, $this->toArray()); |
| 287 | 287 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | public function getIncomingForeignKeys(string $tableName): array |
| 143 | 143 | { |
| 144 | 144 | $junctionTables = $this->schemaAnalyzer->detectJunctionTables(true); |
| 145 | - $junctionTableNames = array_map(function (Table $table) { |
|
| 145 | + $junctionTableNames = array_map(function(Table $table) { |
|
| 146 | 146 | return $table->getName(); |
| 147 | 147 | }, $junctionTables); |
| 148 | 148 | $childrenRelationships = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - return ['(' . implode(') AND (', $sqlParts) . ')', $parameters, $counter]; |
|
| 425 | + return ['('.implode(') AND (', $sqlParts).')', $parameters, $counter]; |
|
| 426 | 426 | } elseif ($filter_bag instanceof ResultIterator) { |
| 427 | 427 | $subQuery = $filter_bag->_getSubQuery(); |
| 428 | 428 | return [$subQuery, [], $counter]; |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | |
| 1001 | 1001 | return $this->fromCache( |
| 1002 | 1002 | $this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
| 1003 | - function () use ($tables) { |
|
| 1003 | + function() use ($tables) { |
|
| 1004 | 1004 | return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
| 1005 | 1005 | } |
| 1006 | 1006 | ); |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | */ |
| 1049 | 1049 | public function _getRelatedTablesByInheritance(string $table): array |
| 1050 | 1050 | { |
| 1051 | - return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
| 1051 | + return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
| 1052 | 1052 | return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
| 1053 | 1053 | }); |
| 1054 | 1054 | } |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | public function findObjects(string $mainTable, $filter = null, array $parameters = array(), $orderString = null, array $additionalTablesFetch = array(), ?int $mode = null, string $className = null, string $resultIteratorClass = ResultIterator::class): ResultIterator |
| 1138 | 1138 | { |
| 1139 | 1139 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
| 1140 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
| 1140 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
| 1141 | 1141 | } |
| 1142 | 1142 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
| 1143 | 1143 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | public function findObjectsFromSql(string $mainTable, string $from, $filter = null, array $parameters = array(), $orderString = null, ?int $mode = null, string $className = null, string $resultIteratorClass = ResultIterator::class): ResultIterator |
| 1175 | 1175 | { |
| 1176 | 1176 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
| 1177 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
| 1177 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
| 1180 | 1180 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | try { |
| 1252 | 1252 | return $this->findObjectOrFail($table, $primaryKeys, [], $additionalTablesFetch, $className); |
| 1253 | 1253 | } catch (NoBeanFoundException $exception) { |
| 1254 | - $primaryKeysStringified = implode(' and ', array_map(function ($key, $value) { |
|
| 1254 | + $primaryKeysStringified = implode(' and ', array_map(function($key, $value) { |
|
| 1255 | 1255 | return "'".$key."' = ".$value; |
| 1256 | 1256 | }, array_keys($primaryKeys), $primaryKeys)); |
| 1257 | 1257 | throw new NoBeanFoundException("No result found for query on table '".$table."' for ".$primaryKeysStringified, 0, $exception); |
@@ -1294,18 +1294,18 @@ discard block |
||
| 1294 | 1294 | if ($count > 1) { |
| 1295 | 1295 | $additionalErrorInfos = ''; |
| 1296 | 1296 | if (is_string($filter) && !empty($parameters)) { |
| 1297 | - $additionalErrorInfos = ' for filter "' . $filter.'"'; |
|
| 1297 | + $additionalErrorInfos = ' for filter "'.$filter.'"'; |
|
| 1298 | 1298 | foreach ($parameters as $fieldName => $parameter) { |
| 1299 | 1299 | if (is_array($parameter)) { |
| 1300 | - $value = '(' . implode(',', $parameter) . ')'; |
|
| 1300 | + $value = '('.implode(',', $parameter).')'; |
|
| 1301 | 1301 | } else { |
| 1302 | 1302 | $value = $parameter; |
| 1303 | 1303 | } |
| 1304 | - $additionalErrorInfos = str_replace(':' . $fieldName, var_export($value, true), $additionalErrorInfos); |
|
| 1304 | + $additionalErrorInfos = str_replace(':'.$fieldName, var_export($value, true), $additionalErrorInfos); |
|
| 1305 | 1305 | } |
| 1306 | 1306 | } |
| 1307 | 1307 | $additionalErrorInfos .= '.'; |
| 1308 | - throw new DuplicateRowException("Error while querying an object in table '$mainTable': More than 1 row have been returned, but we should have received at most one" . $additionalErrorInfos); |
|
| 1308 | + throw new DuplicateRowException("Error while querying an object in table '$mainTable': More than 1 row have been returned, but we should have received at most one".$additionalErrorInfos); |
|
| 1309 | 1309 | } elseif ($count === 0) { |
| 1310 | 1310 | return null; |
| 1311 | 1311 | } |
@@ -1348,7 +1348,7 @@ discard block |
||
| 1348 | 1348 | public function findObjectsFromRawSql(string $mainTable, string $sql, array $parameters = array(), ?int $mode = null, string $className = null, string $sqlCount = null, string $resultIteratorClass = ResultIterator::class): ResultIterator |
| 1349 | 1349 | { |
| 1350 | 1350 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
| 1351 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
| 1351 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
| 1352 | 1352 | } |
| 1353 | 1353 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
| 1354 | 1354 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | $table1 = $fks[0]->getForeignTableName(); |
| 1479 | 1479 | $table2 = $fks[1]->getForeignTableName(); |
| 1480 | 1480 | |
| 1481 | - $beanTables = array_map(function (DbRow $dbRow) { |
|
| 1481 | + $beanTables = array_map(function(DbRow $dbRow) { |
|
| 1482 | 1482 | return $dbRow->_getDbTableName(); |
| 1483 | 1483 | }, $bean->_getDbRows()); |
| 1484 | 1484 | |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |
| 50 | 50 | $fromLock = (bool) $input->getOption('from-lock'); |
| 51 | 51 | |
| 52 | - $loggers = [ new ConsoleLogger($output) ]; |
|
| 52 | + $loggers = [new ConsoleLogger($output)]; |
|
| 53 | 53 | |
| 54 | 54 | $logger = $alteredConf->getLogger(); |
| 55 | 55 | if ($logger) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function createResultIterator(ResultIterator $parentResult, string $magicSql, array $parameters, int $limit, int $offset, array $columnDescriptors, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, int $mode, LoggerInterface $logger): self |
| 80 | 80 | { |
| 81 | - $iterator = new self(); |
|
| 81 | + $iterator = new self(); |
|
| 82 | 82 | $iterator->parentResult = $parentResult; |
| 83 | 83 | $iterator->magicSql = $magicSql; |
| 84 | 84 | $iterator->objectStorage = $objectStorage; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function jsonSerialize() |
| 279 | 279 | { |
| 280 | - return array_map(function (AbstractTDBMObject $item) { |
|
| 280 | + return array_map(function(AbstractTDBMObject $item) { |
|
| 281 | 281 | return $item->jsonSerialize(); |
| 282 | 282 | }, $this->toArray()); |
| 283 | 283 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | public static function createInnerResultIterator(string $magicSql, array $parameters, ?int $limit, ?int $offset, array $columnDescriptors, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, LoggerInterface $logger): self |
| 80 | 80 | { |
| 81 | - $iterator = new static(); |
|
| 81 | + $iterator = new static(); |
|
| 82 | 82 | $iterator->magicSql = $magicSql; |
| 83 | 83 | $iterator->objectStorage = $objectStorage; |
| 84 | 84 | $iterator->className = $className; |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public static function getValidVariableName(string $variableName): string |
| 10 | 10 | { |
| 11 | - $valid = preg_replace_callback('/^(\d+)/', static function (array $match) { |
|
| 11 | + $valid = preg_replace_callback('/^(\d+)/', static function(array $match) { |
|
| 12 | 12 | $f = new \NumberFormatter('en', \NumberFormatter::SPELLOUT); |
| 13 | 13 | $number = $f->format((int) $match[0]); |
| 14 | 14 | return preg_replace('/[^a-z]+/i', '_', $number); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $alias = AbstractQueryFactory::getColumnAlias($tableName, $columnName); |
| 216 | 216 | $astColumn = [ |
| 217 | 217 | 'expr_type' => 'colref', |
| 218 | - 'base_expr' => $connection->quoteIdentifier($tableName) . '.' . $connection->quoteIdentifier($columnName), |
|
| 218 | + 'base_expr' => $connection->quoteIdentifier($tableName).'.'.$connection->quoteIdentifier($columnName), |
|
| 219 | 219 | 'no_quotes' => [ |
| 220 | 220 | 'delim' => '.', |
| 221 | 221 | 'parts' => [ |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | return $this->generateWrappedSqlCount($parsedSql); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - $countSubExpr = array_map(function (array $item) { |
|
| 306 | + $countSubExpr = array_map(function(array $item) { |
|
| 307 | 307 | unset($item['alias']); |
| 308 | 308 | return $item; |
| 309 | 309 | }, $parsedSql['SELECT']); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $item['delim'] = ','; |
| 381 | 381 | $innerColumns[] = $item; |
| 382 | 382 | } |
| 383 | - $innerColumns[count($innerColumns)-1]['delim'] = false; |
|
| 383 | + $innerColumns[count($innerColumns) - 1]['delim'] = false; |
|
| 384 | 384 | $parsedSql['SELECT'] = $innerColumns; |
| 385 | 385 | |
| 386 | 386 | $parsedSql = [ |