@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function getPhpType(): string |
| 89 | 89 | { |
| 90 | - return '\\' . $this->beanNamespace . '\\' . $this->getClassName(); |
|
| 90 | + return '\\'.$this->beanNamespace.'\\'.$this->getClassName(); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $referencedBeanName = $this->namingStrategy->getBeanClassName($this->foreignKey->getForeignTableName()); |
| 161 | 161 | |
| 162 | 162 | $getter = new MethodGenerator($getterName); |
| 163 | - $getter->setDocBlock(new DocBlockGenerator('Returns the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
| 163 | + $getter->setDocBlock(new DocBlockGenerator('Returns the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
| 164 | 164 | |
| 165 | 165 | /*$types = [ $referencedBeanName ]; |
| 166 | 166 | if ($isNullable) { |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | $getter->getDocBlock()->setTag(new ReturnTag($types));*/ |
| 170 | 170 | |
| 171 | - $getter->setReturnType(($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName); |
|
| 171 | + $getter->setReturnType(($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName); |
|
| 172 | 172 | $tdbmFk = ForeignKey::createFromFk($this->foreignKey); |
| 173 | 173 | |
| 174 | - $getter->setBody('return $this->getRef(' . var_export($tdbmFk->getCacheKey(), true) . ', ' . var_export($tableName, true) . ');'); |
|
| 174 | + $getter->setBody('return $this->getRef('.var_export($tdbmFk->getCacheKey(), true).', '.var_export($tableName, true).');'); |
|
| 175 | 175 | |
| 176 | 176 | if ($this->isGetterProtected()) { |
| 177 | 177 | $getter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | if (!$this->isReadOnly()) { |
| 181 | 181 | $setter = new MethodGenerator($setterName); |
| 182 | - $setter->setDocBlock(new DocBlockGenerator('The setter for the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
| 182 | + $setter->setDocBlock(new DocBlockGenerator('The setter for the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
| 183 | 183 | |
| 184 | - $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName)); |
|
| 184 | + $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName)); |
|
| 185 | 185 | |
| 186 | 186 | $setter->setReturnType('void'); |
| 187 | 187 | |
| 188 | - $setter->setBody('$this->setRef(' . var_export($tdbmFk->getCacheKey(), true) . ', $object, ' . var_export($tableName, true) . ');'); |
|
| 188 | + $setter->setBody('$this->setRef('.var_export($tdbmFk->getCacheKey(), true).', $object, '.var_export($tableName, true).');'); |
|
| 189 | 189 | |
| 190 | 190 | if ($this->isSetterProtected()) { |
| 191 | 191 | $setter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
| 225 | 225 | $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
| 226 | 226 | if ($jsonFormat !== null) { |
| 227 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
| 227 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
| 228 | 228 | $format = "$method()"; |
| 229 | 229 | } else { |
| 230 | 230 | $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | $columnGetterName = $descriptor->getGetterName(); |
| 273 | 273 | $rows[] = "'$indexName' => $propertyAccess->$columnGetterName()"; |
| 274 | 274 | } else { |
| 275 | - throw new TDBMException('PropertyDescriptor of class `' . get_class($descriptor) . '` cannot be serialized.'); |
|
| 275 | + throw new TDBMException('PropertyDescriptor of class `'.get_class($descriptor).'` cannot be serialized.'); |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | - return '[' . implode(', ', $rows) . ']'; |
|
| 278 | + return '['.implode(', ', $rows).']'; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | private function getBeanPropertyDescriptor(string $column): AbstractBeanPropertyDescriptor |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | return $descriptor; |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | - throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`' . $column . '` not found in `' . $this->foreignBeanDescriptor->getTable()->getName() . '`'); |
|
| 288 | + throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`'.$column.'` not found in `'.$this->foreignBeanDescriptor->getTable()->getName().'`'); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | |
| 51 | 51 | $pkColumnNames = $this->tdbmService->getPrimaryKeyColumns($this->mainTable); |
| 52 | 52 | $mysqlPlatform = new MySqlPlatform(); |
| 53 | - $pkColumnNames = array_map(function ($pkColumn) use ($mysqlPlatform) { |
|
| 53 | + $pkColumnNames = array_map(function($pkColumn) use ($mysqlPlatform) { |
|
| 54 | 54 | return $mysqlPlatform->quoteIdentifier($this->mainTable).'.'.$mysqlPlatform->quoteIdentifier($pkColumn); |
| 55 | 55 | }, $pkColumnNames); |
| 56 | 56 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | // Let's compute the COUNT. |
| 51 | 51 | $pkColumnNames = $this->tdbmService->getPrimaryKeyColumns($this->mainTable); |
| 52 | - $pkColumnNames = array_map(function ($pkColumn) use ($mySqlPlatform) { |
|
| 52 | + $pkColumnNames = array_map(function($pkColumn) use ($mySqlPlatform) { |
|
| 53 | 53 | return $mySqlPlatform->quoteIdentifier($this->mainTable).'.'.$mySqlPlatform->quoteIdentifier($pkColumn); |
| 54 | 54 | }, $pkColumnNames); |
| 55 | 55 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | private function getParentRelationshipForeignKeys(string $tableName): array |
| 115 | 115 | { |
| 116 | - return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function () use ($tableName) { |
|
| 116 | + return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function() use ($tableName) { |
|
| 117 | 117 | return $this->getParentRelationshipForeignKeysWithoutCache($tableName); |
| 118 | 118 | }); |
| 119 | 119 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | private function getChildrenRelationshipForeignKeys(string $tableName) : array |
| 144 | 144 | { |
| 145 | - return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function () use ($tableName) { |
|
| 145 | + return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function() use ($tableName) { |
|
| 146 | 146 | return $this->getChildrenRelationshipForeignKeysWithoutCache($tableName); |
| 147 | 147 | }); |
| 148 | 148 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $children = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
| 158 | 158 | |
| 159 | 159 | if (!empty($children)) { |
| 160 | - $fksTables = array_map(function (ForeignKeyConstraint $fk) { |
|
| 160 | + $fksTables = array_map(function(ForeignKeyConstraint $fk) { |
|
| 161 | 161 | return $this->getChildrenRelationshipForeignKeys($fk->getLocalTableName()); |
| 162 | 162 | }, $children); |
| 163 | 163 | |
@@ -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 | } |