@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // Let's compute the COUNT. |
| 53 | 53 | $pkColumnNames = $this->tdbmService->getPrimaryKeyColumns($this->mainTable); |
| 54 | - $pkColumnNames = array_map(function ($pkColumn) use ($mySqlPlatform) { |
|
| 54 | + $pkColumnNames = array_map(function($pkColumn) use ($mySqlPlatform) { |
|
| 55 | 55 | return $mySqlPlatform->quoteIdentifier($this->mainTable).'.'.$mySqlPlatform->quoteIdentifier($pkColumn); |
| 56 | 56 | }, $pkColumnNames); |
| 57 | 57 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | private function getParentRelationshipForeignKeys(string $tableName): array |
| 117 | 117 | { |
| 118 | - return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function () use ($tableName) { |
|
| 118 | + return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function() use ($tableName) { |
|
| 119 | 119 | return $this->getParentRelationshipForeignKeysWithoutCache($tableName); |
| 120 | 120 | }); |
| 121 | 121 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | private function getChildrenRelationshipForeignKeys(string $tableName): array |
| 146 | 146 | { |
| 147 | - return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function () use ($tableName) { |
|
| 147 | + return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function() use ($tableName) { |
|
| 148 | 148 | return $this->getChildrenRelationshipForeignKeysWithoutCache($tableName); |
| 149 | 149 | }); |
| 150 | 150 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $children = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
| 160 | 160 | |
| 161 | 161 | if (!empty($children)) { |
| 162 | - $fksTables = array_map(function (ForeignKeyConstraint $fk) { |
|
| 162 | + $fksTables = array_map(function(ForeignKeyConstraint $fk) { |
|
| 163 | 163 | return $this->getChildrenRelationshipForeignKeys($fk->getLocalTableName()); |
| 164 | 164 | }, $children); |
| 165 | 165 | |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | $localTableName = $incomingFk->getLocalTableName(); |
| 369 | 369 | |
| 370 | - $className = $this->beanNamespace . '\\' . $this->namingStrategy->getBeanClassName($localTableName); |
|
| 370 | + $className = $this->beanNamespace.'\\'.$this->namingStrategy->getBeanClassName($localTableName); |
|
| 371 | 371 | assert(class_exists($className)); |
| 372 | 372 | |
| 373 | - $resultIteratorClassName = $this->resultIteratorNamespace . '\\' . $this->namingStrategy->getResultIteratorClassName($localTableName); |
|
| 373 | + $resultIteratorClassName = $this->resultIteratorNamespace.'\\'.$this->namingStrategy->getResultIteratorClassName($localTableName); |
|
| 374 | 374 | assert(class_exists($resultIteratorClassName)); |
| 375 | 375 | |
| 376 | 376 | $results = $this->findObjects( |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - return ['(' . implode(') AND (', $sqlParts) . ')', $parameters, $counter]; |
|
| 443 | + return ['('.implode(') AND (', $sqlParts).')', $parameters, $counter]; |
|
| 444 | 444 | } elseif ($filter_bag instanceof ResultIterator) { |
| 445 | 445 | $subQuery = $filter_bag->_getSubQuery(); |
| 446 | 446 | return [$subQuery, [], $counter]; |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | |
| 1020 | 1020 | return $this->fromCache( |
| 1021 | 1021 | $this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
| 1022 | - function () use ($tables) { |
|
| 1022 | + function() use ($tables) { |
|
| 1023 | 1023 | return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
| 1024 | 1024 | } |
| 1025 | 1025 | ); |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | */ |
| 1068 | 1068 | public function _getRelatedTablesByInheritance(string $table): array |
| 1069 | 1069 | { |
| 1070 | - return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
| 1070 | + return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
| 1071 | 1071 | return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
| 1072 | 1072 | }); |
| 1073 | 1073 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | public function findObjects(string $mainTable, $filter, array $parameters, $orderString, array $additionalTablesFetch, ?int $mode, ?string $className, string $resultIteratorClass): ResultIterator |
| 1157 | 1157 | { |
| 1158 | 1158 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
| 1159 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
| 1159 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
| 1160 | 1160 | } |
| 1161 | 1161 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
| 1162 | 1162 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | public function findObjectsFromSql(string $mainTable, string $from, $filter, array $parameters, $orderString, ?int $mode, ?string $className, string $resultIteratorClass): ResultIterator |
| 1194 | 1194 | { |
| 1195 | 1195 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
| 1196 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
| 1196 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
| 1199 | 1199 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1226,8 +1226,8 @@ discard block |
||
| 1226 | 1226 | */ |
| 1227 | 1227 | public function findObjectByPk(string $table, array $primaryKeys, array $additionalTablesFetch, bool $lazy, string $className, string $resultIteratorClass): AbstractTDBMObject |
| 1228 | 1228 | { |
| 1229 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
| 1230 | - assert(is_a($className, AbstractTDBMObject::class, true), new TDBMInvalidArgumentException('$className should be a `'. AbstractTDBMObject::class. '`. `' . $className . '` provided.')); |
|
| 1229 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
| 1230 | + assert(is_a($className, AbstractTDBMObject::class, true), new TDBMInvalidArgumentException('$className should be a `'.AbstractTDBMObject::class.'`. `'.$className.'` provided.')); |
|
| 1231 | 1231 | $primaryKeys = $this->_getPrimaryKeysFromObjectData($table, $primaryKeys); |
| 1232 | 1232 | $hash = $this->getObjectHash($primaryKeys); |
| 1233 | 1233 | |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | */ |
| 1285 | 1285 | public function findObject(string $mainTable, $filter, array $parameters, array $additionalTablesFetch, string $className, string $resultIteratorClass): ?AbstractTDBMObject |
| 1286 | 1286 | { |
| 1287 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
| 1287 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
| 1288 | 1288 | $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className, $resultIteratorClass); |
| 1289 | 1289 | return $this->getAtMostOneObjectOrFail($objects, $mainTable, $filter, $parameters); |
| 1290 | 1290 | } |
@@ -1306,18 +1306,18 @@ discard block |
||
| 1306 | 1306 | if ($count > 1) { |
| 1307 | 1307 | $additionalErrorInfos = ''; |
| 1308 | 1308 | if (is_string($filter) && !empty($parameters)) { |
| 1309 | - $additionalErrorInfos = ' for filter "' . $filter.'"'; |
|
| 1309 | + $additionalErrorInfos = ' for filter "'.$filter.'"'; |
|
| 1310 | 1310 | foreach ($parameters as $fieldName => $parameter) { |
| 1311 | 1311 | if (is_array($parameter)) { |
| 1312 | - $value = '(' . implode(',', $parameter) . ')'; |
|
| 1312 | + $value = '('.implode(',', $parameter).')'; |
|
| 1313 | 1313 | } else { |
| 1314 | 1314 | $value = $parameter; |
| 1315 | 1315 | } |
| 1316 | - $additionalErrorInfos = str_replace(':' . $fieldName, var_export($value, true), $additionalErrorInfos); |
|
| 1316 | + $additionalErrorInfos = str_replace(':'.$fieldName, var_export($value, true), $additionalErrorInfos); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | } |
| 1319 | 1319 | $additionalErrorInfos .= '.'; |
| 1320 | - 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); |
|
| 1320 | + 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); |
|
| 1321 | 1321 | } elseif ($count === 0) { |
| 1322 | 1322 | return null; |
| 1323 | 1323 | } |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | */ |
| 1342 | 1342 | public function findObjectFromSql(string $mainTable, string $from, $filter, array $parameters, ?string $className, string $resultIteratorClass): ?AbstractTDBMObject |
| 1343 | 1343 | { |
| 1344 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
| 1344 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
| 1345 | 1345 | $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className, $resultIteratorClass); |
| 1346 | 1346 | return $this->getAtMostOneObjectOrFail($objects, $mainTable, $filter, $parameters); |
| 1347 | 1347 | } |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | public function findObjectsFromRawSql(string $mainTable, string $sql, array $parameters, ?int $mode, ?string $className, ?string $sqlCount, string $resultIteratorClass): ResultIterator |
| 1363 | 1363 | { |
| 1364 | 1364 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
| 1365 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
| 1365 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
| 1366 | 1366 | } |
| 1367 | 1367 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
| 1368 | 1368 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | */ |
| 1394 | 1394 | public function findObjectOrFail(string $mainTable, $filter, array $parameters, array $additionalTablesFetch, string $className, string $resultIteratorClass): AbstractTDBMObject |
| 1395 | 1395 | { |
| 1396 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
| 1396 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
| 1397 | 1397 | $bean = $this->findObject($mainTable, $filter, $parameters, $additionalTablesFetch, $className, $resultIteratorClass); |
| 1398 | 1398 | if ($bean === null) { |
| 1399 | 1399 | throw NoBeanFoundException::missFilterRecord($mainTable); |
@@ -1506,7 +1506,7 @@ discard block |
||
| 1506 | 1506 | $table1 = $fks[0]->getForeignTableName(); |
| 1507 | 1507 | $table2 = $fks[1]->getForeignTableName(); |
| 1508 | 1508 | |
| 1509 | - $beanTables = array_map(function (DbRow $dbRow) { |
|
| 1509 | + $beanTables = array_map(function(DbRow $dbRow) { |
|
| 1510 | 1510 | return $dbRow->_getDbTableName(); |
| 1511 | 1511 | }, $bean->_getDbRows()); |
| 1512 | 1512 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | public function getName(): string |
| 71 | 71 | { |
| 72 | 72 | if (!$this->useAlternateName) { |
| 73 | - return 'get' . $this->getPropertyName(); |
|
| 73 | + return 'get'.$this->getPropertyName(); |
|
| 74 | 74 | } else { |
| 75 | - $methodName = 'get' . $this->getPropertyName() . 'By'; |
|
| 75 | + $methodName = 'get'.$this->getPropertyName().'By'; |
|
| 76 | 76 | |
| 77 | 77 | $camelizedColumns = array_map([TDBMDaoGenerator::class, 'toCamelCase'], $this->foreignKey->getUnquotedLocalColumns()); |
| 78 | 78 | |
@@ -137,23 +137,23 @@ discard block |
||
| 137 | 137 | $getter = new MethodGenerator($this->getName()); |
| 138 | 138 | |
| 139 | 139 | if ($this->hasLocalUniqueIndex()) { |
| 140 | - $classType = '\\' . $this->beanNamespace . '\\' . $beanClass; |
|
| 140 | + $classType = '\\'.$this->beanNamespace.'\\'.$beanClass; |
|
| 141 | 141 | $getterDocBlock = new DocBlockGenerator(sprintf('Returns the %s pointing to this bean via the %s column.', $beanClass, implode(', ', $this->foreignKey->getUnquotedLocalColumns()))); |
| 142 | - $getterDocBlock->setTag([new ReturnTag([$classType . '|null'])]); |
|
| 142 | + $getterDocBlock->setTag([new ReturnTag([$classType.'|null'])]); |
|
| 143 | 143 | $getterDocBlock->setWordWrap(false); |
| 144 | 144 | $getter->setDocBlock($getterDocBlock); |
| 145 | - $getter->setReturnType('?' . $classType); |
|
| 145 | + $getter->setReturnType('?'.$classType); |
|
| 146 | 146 | |
| 147 | 147 | $code = sprintf( |
| 148 | 148 | 'return $this->retrieveManyToOneRelationshipsStorage(%s, %s, %s, null, %s)->first();', |
| 149 | 149 | var_export($this->foreignKey->getLocalTableName(), true), |
| 150 | 150 | var_export($tdbmFk->getCacheKey(), true), |
| 151 | 151 | $this->getFilters($this->foreignKey), |
| 152 | - '\\' . $this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName() .'::class' |
|
| 152 | + '\\'.$this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName().'::class' |
|
| 153 | 153 | ); |
| 154 | 154 | } else { |
| 155 | 155 | $getterDocBlock = new DocBlockGenerator(sprintf('Returns the list of %s pointing to this bean via the %s column.', $beanClass, implode(', ', $this->foreignKey->getUnquotedLocalColumns()))); |
| 156 | - $getterDocBlock->setTag(new ReturnTag([$beanClass . '[]', '\\' . AlterableResultIterator::class])); |
|
| 156 | + $getterDocBlock->setTag(new ReturnTag([$beanClass.'[]', '\\'.AlterableResultIterator::class])); |
|
| 157 | 157 | $getterDocBlock->setWordWrap(false); |
| 158 | 158 | $getter->setDocBlock($getterDocBlock); |
| 159 | 159 | $getter->setReturnType(AlterableResultIterator::class); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | var_export($this->foreignKey->getLocalTableName(), true), |
| 164 | 164 | var_export($tdbmFk->getCacheKey(), true), |
| 165 | 165 | $this->getFilters($this->foreignKey), |
| 166 | - '\\' . $this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName() .'::class' |
|
| 166 | + '\\'.$this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName().'::class' |
|
| 167 | 167 | ); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $getter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - return [ $getter ]; |
|
| 176 | + return [$getter]; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | private function getFilters(ForeignKeyConstraint $fk): string |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
| 246 | 246 | $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
| 247 | 247 | if ($jsonFormat !== null) { |
| 248 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
| 248 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
| 249 | 249 | $format = "$method()"; |
| 250 | 250 | } else { |
| 251 | 251 | $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $isIncluded = $this->findAnnotation(Annotation\JsonInclude::class) !== null; |
| 255 | 255 | $index = $jsonCollection->key ?: lcfirst($this->getPropertyName()); |
| 256 | 256 | $class = $this->getBeanClassName(); |
| 257 | - $variableName = '$' . TDBMDaoGenerator::toVariableName($class); |
|
| 257 | + $variableName = '$'.TDBMDaoGenerator::toVariableName($class); |
|
| 258 | 258 | $getter = $this->getName(); |
| 259 | 259 | if ($this->hasLocalUniqueIndex()) { |
| 260 | 260 | $code = "\$array['$index'] = (\$object = \$this->$getter()) ? \$object->$format : null;"; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | 'time', |
| 164 | 164 | 'time_immutable', |
| 165 | 165 | ], true)) { |
| 166 | - if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */ , 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
| 166 | + if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */, 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
| 167 | 167 | $defaultCode = 'new \DateTimeImmutable()'; |
| 168 | 168 | } else { |
| 169 | 169 | throw new TDBMException('Unable to set default value for date in "'.$this->table->getName().'.'.$this->column->getName().'". Database passed this default value: "'.$default.'"'); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | case 'v4': |
| 188 | 188 | return 'Uuid::uuid4()->toString()'; |
| 189 | 189 | default: |
| 190 | - throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: ' . $comment); |
|
| 190 | + throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: '.$comment); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $resourceTypeCheck = sprintf($resourceTypeCheck, $checkNullable, $variableName, $variableName); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $types = [ $normalizedType ]; |
|
| 238 | + $types = [$normalizedType]; |
|
| 239 | 239 | if ($isNullable) { |
| 240 | 240 | $types[] = 'null'; |
| 241 | 241 | } |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | break; |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | - $args = array_map(function ($v) { |
|
| 341 | + $args = array_map(function($v) { |
|
| 342 | 342 | return var_export($v, true); |
| 343 | 343 | }, $args); |
| 344 | - $args = empty($args) ? '' : ', ' . implode(', ', $args); |
|
| 345 | - $unit = $jsonFormat->unit ? ' . ' . var_export($jsonFormat->unit, true) : ''; |
|
| 344 | + $args = empty($args) ? '' : ', '.implode(', ', $args); |
|
| 345 | + $unit = $jsonFormat->unit ? ' . '.var_export($jsonFormat->unit, true) : ''; |
|
| 346 | 346 | if ($this->column->getNotnull()) { |
| 347 | 347 | return "\$array['$index'] = number_format(\$this->$getter()$args)$unit;"; |
| 348 | 348 | } else { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | protected function setRef(string $foreignKeyName, ?AbstractTDBMObject $bean, string $tableName, string $className, string $resultIteratorClass): void |
| 260 | 260 | { |
| 261 | - assert($bean === null || is_a($bean, $className), new TDBMInvalidArgumentException('$bean should be `null` or `' . $className . '`. `' . ($bean === null ? 'null' : get_class($bean)) . '` provided.')); |
|
| 261 | + assert($bean === null || is_a($bean, $className), new TDBMInvalidArgumentException('$bean should be `null` or `'.$className.'`. `'.($bean === null ? 'null' : get_class($bean)).'` provided.')); |
|
| 262 | 262 | |
| 263 | 263 | if (!isset($this->dbRows[$tableName])) { |
| 264 | 264 | $this->registerTable($tableName); |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | protected function retrieveManyToOneRelationshipsStorage(string $tableName, string $foreignKeyName, array $searchFilter, ?string $orderString, string $resultIteratorClass): AlterableResultIterator |
| 524 | 524 | { |
| 525 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
| 525 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
| 526 | 526 | $key = $tableName.'___'.$foreignKeyName; |
| 527 | 527 | $alterableResultIterator = $this->getManyToOneAlterableResultIterator($tableName, $foreignKeyName); |
| 528 | 528 | if ($this->status === TDBMObjectStateEnum::STATE_DETACHED || $this->status === TDBMObjectStateEnum::STATE_NEW || (isset($this->manyToOneRelationships[$key]) && $this->manyToOneRelationships[$key]->getUnderlyingResultIterator() !== null)) { |
@@ -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); |