@@ -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)) { |
@@ -1291,18 +1291,18 @@ discard block |
||
| 1291 | 1291 | if ($count > 1) { |
| 1292 | 1292 | $additionalErrorInfos = ''; |
| 1293 | 1293 | if (is_string($filter) && !empty($parameters)) { |
| 1294 | - $additionalErrorInfos = ' for filter "' . $filter.'"'; |
|
| 1294 | + $additionalErrorInfos = ' for filter "'.$filter.'"'; |
|
| 1295 | 1295 | foreach ($parameters as $fieldName => $parameter) { |
| 1296 | 1296 | if (is_array($parameter)) { |
| 1297 | - $value = '(' . implode(',', $parameter) . ')'; |
|
| 1297 | + $value = '('.implode(',', $parameter).')'; |
|
| 1298 | 1298 | } else { |
| 1299 | 1299 | $value = $parameter; |
| 1300 | 1300 | } |
| 1301 | - $additionalErrorInfos = str_replace(':' . $fieldName, var_export($value, true), $additionalErrorInfos); |
|
| 1301 | + $additionalErrorInfos = str_replace(':'.$fieldName, var_export($value, true), $additionalErrorInfos); |
|
| 1302 | 1302 | } |
| 1303 | 1303 | } |
| 1304 | 1304 | $additionalErrorInfos .= '.'; |
| 1305 | - 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); |
|
| 1305 | + 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); |
|
| 1306 | 1306 | } elseif ($count === 0) { |
| 1307 | 1307 | return null; |
| 1308 | 1308 | } |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | public function findObjectsFromRawSql(string $mainTable, string $sql, array $parameters = array(), ?int $mode = null, string $className = null, string $sqlCount = null, string $resultIteratorClass = ResultIterator::class): ResultIterator |
| 1346 | 1346 | { |
| 1347 | 1347 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
| 1348 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
| 1348 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
| 1349 | 1349 | } |
| 1350 | 1350 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
| 1351 | 1351 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1475,7 +1475,7 @@ discard block |
||
| 1475 | 1475 | $table1 = $fks[0]->getForeignTableName(); |
| 1476 | 1476 | $table2 = $fks[1]->getForeignTableName(); |
| 1477 | 1477 | |
| 1478 | - $beanTables = array_map(function (DbRow $dbRow) { |
|
| 1478 | + $beanTables = array_map(function(DbRow $dbRow) { |
|
| 1479 | 1479 | return $dbRow->_getDbTableName(); |
| 1480 | 1480 | }, $bean->_getDbRows()); |
| 1481 | 1481 | |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public static function missPrimaryKeyRecord(string $tableName, array $primaryKeys, string $className, Exception $previous) : self |
| 37 | 37 | { |
| 38 | - $primaryKeysStringified = implode(' and ', array_map(function ($key, $value) { |
|
| 38 | + $primaryKeysStringified = implode(' and ', array_map(function($key, $value) { |
|
| 39 | 39 | return "'".$key."' = ".$value; |
| 40 | 40 | }, array_keys($primaryKeys), $primaryKeys)); |
| 41 | 41 | $exception = new self("No result found for query on table '".$tableName."' for ".$primaryKeysStringified, 0, $previous); |