From ca76af49f59ac5bd48f8333ab58d9d659ad14dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Sun, 29 Mar 2026 04:17:48 +0200 Subject: [PATCH 1/2] Replace static Type::* calls with instance-based TypeRegistry lookups All internal callers now resolve types through Configuration::getTypeRegistry() rather than the global static Type::getType() / Type::hasType() / Type::getTypeRegistry() methods. Remaining static calls are justified fallbacks: - Configuration::getTypeRegistry() falls back to Type::getTypeRegistry() for DBAL v3 compatibility (no Configuration::getTypeRegistry() there) - LengthFunction and CountFunction: getReturnType() has no EM access, accessing built-in INTEGER type only - DatabaseDriver: deprecated class, no EM access available --- src/Configuration.php | 18 ++++++++++++++ src/Internal/Hydration/AbstractHydrator.php | 15 ++++++++---- .../Collection/OneToManyPersister.php | 3 +-- .../AbstractEntityInheritancePersister.php | 3 +-- .../Entity/BasicEntityPersister.php | 15 ++++++++---- .../Entity/JoinedSubclassPersister.php | 3 +-- src/Query/Exec/MultiTableDeleteExecutor.php | 3 +-- src/Query/Exec/MultiTableUpdateExecutor.php | 3 +-- src/Query/ResultSetMappingBuilder.php | 3 +-- src/Query/SqlWalker.php | 24 +++++++++++++------ src/Tools/Pagination/LimitSubqueryWalker.php | 3 +-- src/Tools/SchemaValidator.php | 6 ++--- src/Utility/PersisterHelper.php | 7 +++--- 13 files changed, 68 insertions(+), 38 deletions(-) diff --git a/src/Configuration.php b/src/Configuration.php index 9280cdc1898..65661e5f8fb 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -5,6 +5,8 @@ namespace Doctrine\ORM; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\TypeRegistry; use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\Cache\CacheConfiguration; use Doctrine\ORM\Exception\InvalidEntityRepository; @@ -29,6 +31,7 @@ use function class_exists; use function is_a; +use function method_exists; use function strtolower; use const PHP_VERSION_ID; @@ -723,4 +726,19 @@ public function getEagerFetchBatchSize(): int { return $this->attributes['fetchModeSubselectBatchSize'] ?? 100; } + + /** + * Returns the type registry for this configuration. + * Falls back to the global type registry when running against DBAL < 4.5, + * which does not have {@see \Doctrine\DBAL\Configuration::getTypeRegistry()}. + */ + public function getTypeRegistry(): TypeRegistry + { + // @phpstan-ignore function.alreadyNarrowedType (method_exists check is for DBAL v3 compatibility) + if (method_exists(parent::class, 'getTypeRegistry')) { + return parent::getTypeRegistry(); + } + + return Type::getTypeRegistry(); + } } diff --git a/src/Internal/Hydration/AbstractHydrator.php b/src/Internal/Hydration/AbstractHydrator.php index 56158ed32cf..a341745a6cc 100644 --- a/src/Internal/Hydration/AbstractHydrator.php +++ b/src/Internal/Hydration/AbstractHydrator.php @@ -89,6 +89,11 @@ public function __construct(protected EntityManagerInterface $em) $this->uow = $em->getUnitOfWork(); } + private function getType(string $name): Type + { + return $this->em->getConfiguration()->getTypeRegistry()->get($name); + } + /** * Initiates a row-by-row hydration. * @@ -458,7 +463,7 @@ protected function hydrateColumnInfo(string $key): array|null $columnInfo = [ 'isIdentifier' => in_array($fieldName, $classMetadata->identifier, true), 'fieldName' => $fieldName, - 'type' => Type::getType($fieldMapping->type), + 'type' => $this->getType($fieldMapping->type), 'dqlAlias' => $ownerMap, 'enumType' => $this->rsm->enumMappings[$key] ?? null, ]; @@ -486,7 +491,7 @@ protected function hydrateColumnInfo(string $key): array|null 'isScalar' => true, 'isNewObjectParameter' => true, 'fieldName' => $this->rsm->scalarMappings[$key], - 'type' => Type::getType($this->rsm->typeMappings[$key]), + 'type' => $this->getType($this->rsm->typeMappings[$key]), 'argIndex' => $mapping['argIndex'], 'objIndex' => $mapping['objIndex'], 'enumType' => $this->rsm->enumMappings[$key] ?? null, @@ -495,7 +500,7 @@ protected function hydrateColumnInfo(string $key): array|null case isset($this->rsm->scalarMappings[$key], $this->hints[LimitSubqueryWalker::FORCE_DBAL_TYPE_CONVERSION]): return $this->cache[$key] = [ 'fieldName' => $this->rsm->scalarMappings[$key], - 'type' => Type::getType($this->rsm->typeMappings[$key]), + 'type' => $this->getType($this->rsm->typeMappings[$key]), 'dqlAlias' => '', 'enumType' => $this->rsm->enumMappings[$key] ?? null, ]; @@ -504,7 +509,7 @@ protected function hydrateColumnInfo(string $key): array|null return $this->cache[$key] = [ 'isScalar' => true, 'fieldName' => $this->rsm->scalarMappings[$key], - 'type' => Type::getType($this->rsm->typeMappings[$key]), + 'type' => $this->getType($this->rsm->typeMappings[$key]), 'enumType' => $this->rsm->enumMappings[$key] ?? null, ]; @@ -513,7 +518,7 @@ protected function hydrateColumnInfo(string $key): array|null $fieldName = $this->rsm->metaMappings[$key]; $dqlAlias = $this->rsm->columnOwnerMap[$key]; $type = isset($this->rsm->typeMappings[$key]) - ? Type::getType($this->rsm->typeMappings[$key]) + ? $this->getType($this->rsm->typeMappings[$key]) : null; // Cache metadata fetch diff --git a/src/Persisters/Collection/OneToManyPersister.php b/src/Persisters/Collection/OneToManyPersister.php index 229fe671d31..8bba7fe48ea 100644 --- a/src/Persisters/Collection/OneToManyPersister.php +++ b/src/Persisters/Collection/OneToManyPersister.php @@ -7,7 +7,6 @@ use BadMethodCallException; use Doctrine\Common\Collections\Criteria; use Doctrine\DBAL\Exception as DBALException; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\EntityNotFoundException; use Doctrine\ORM\Mapping\MappingException; use Doctrine\ORM\Mapping\OneToManyAssociationMapping; @@ -224,7 +223,7 @@ private function deleteJoinedEntityCollection(PersistentCollection $collection): $columnDefinitions[$idColumnName] = [ 'name' => $idColumnName, 'notnull' => true, - 'type' => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $this->em)), + 'type' => $this->em->getConfiguration()->getTypeRegistry()->get(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $this->em)), ]; } diff --git a/src/Persisters/Entity/AbstractEntityInheritancePersister.php b/src/Persisters/Entity/AbstractEntityInheritancePersister.php index cf8a74eb619..8572bc5d225 100644 --- a/src/Persisters/Entity/AbstractEntityInheritancePersister.php +++ b/src/Persisters/Entity/AbstractEntityInheritancePersister.php @@ -4,7 +4,6 @@ namespace Doctrine\ORM\Persisters\Entity; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\ClassMetadata; use function sprintf; @@ -49,7 +48,7 @@ protected function getSelectColumnSQL(string $field, ClassMetadata $class, strin $this->currentPersisterContext->rsm->addFieldResult($alias, $columnAlias, $field, $class->name); - $type = Type::getType($fieldMapping->type); + $type = $this->getType($fieldMapping->type); $sql = $type->convertToPHPValueSQL($sql, $this->platform); return $sql . ' AS ' . $columnAlias; diff --git a/src/Persisters/Entity/BasicEntityPersister.php b/src/Persisters/Entity/BasicEntityPersister.php index 28e287399ff..5177f4ff316 100644 --- a/src/Persisters/Entity/BasicEntityPersister.php +++ b/src/Persisters/Entity/BasicEntityPersister.php @@ -203,6 +203,11 @@ final protected function updateFilterHash(): void $this->filterHash = $this->em->getFilters()->getHash(); } + final protected function getType(string $name): Type + { + return $this->em->getConfiguration()->getTypeRegistry()->get($name); + } + public function getClassMetadata(): ClassMetadata { return $this->class; @@ -290,7 +295,7 @@ protected function assignDefaultVersionAndUpsertableValues(object $entity, array $values = $this->fetchVersionAndNotUpsertableValues($this->class, $id); foreach ($values as $field => $value) { - $value = Type::getType($this->class->fieldMappings[$field]->type)->convertToPHPValue($value, $this->platform); + $value = $this->getType($this->class->fieldMappings[$field]->type)->convertToPHPValue($value, $this->platform); $this->class->setFieldValue($entity, $field, $value); } @@ -416,7 +421,7 @@ final protected function updateTable( $column = $this->quoteStrategy->getColumnName($fieldName, $this->class, $this->platform); if (isset($this->class->fieldMappings[$fieldName])) { - $type = Type::getType($this->columnTypes[$columnName]); + $type = $this->getType($this->columnTypes[$columnName]); $placeholder = $type->convertToDatabaseValueSQL('?', $this->platform); } @@ -1453,7 +1458,7 @@ public function getInsertSQL(): string && isset($this->columnTypes[$this->class->fieldNames[$column]]) && isset($this->class->fieldMappings[$this->class->fieldNames[$column]]) ) { - $type = Type::getType($this->columnTypes[$this->class->fieldNames[$column]]); + $type = $this->getType($this->columnTypes[$this->class->fieldNames[$column]]); $placeholder = $type->convertToDatabaseValueSQL('?', $this->platform); } @@ -1539,7 +1544,7 @@ protected function getSelectColumnSQL(string $field, ClassMetadata $class, strin $this->currentPersisterContext->rsm->addEnumResult($columnAlias, $fieldMapping->enumType); } - $type = Type::getType($fieldMapping->type); + $type = $this->getType($fieldMapping->type); $sql = $type->convertToPHPValueSQL($sql, $this->platform); return $sql . ' AS ' . $columnAlias; @@ -1646,7 +1651,7 @@ public function getSelectConditionStatementSQL( $placeholder = '?'; if (isset($this->class->fieldMappings[$field])) { - $type = Type::getType($this->class->fieldMappings[$field]->type); + $type = $this->getType($this->class->fieldMappings[$field]->type); $placeholder = $type->convertToDatabaseValueSQL($placeholder, $this->platform); } diff --git a/src/Persisters/Entity/JoinedSubclassPersister.php b/src/Persisters/Entity/JoinedSubclassPersister.php index f7e6cf8ec78..cf6bcfa715c 100644 --- a/src/Persisters/Entity/JoinedSubclassPersister.php +++ b/src/Persisters/Entity/JoinedSubclassPersister.php @@ -6,7 +6,6 @@ use Doctrine\Common\Collections\Criteria; use Doctrine\DBAL\LockMode; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Internal\SQLResultCasing; use Doctrine\ORM\Mapping\AssociationMapping; @@ -511,7 +510,7 @@ protected function assignDefaultVersionAndUpsertableValues(object $entity, array $values = $this->fetchVersionAndNotUpsertableValues($this->getVersionedClassMetadata(), $id); foreach ($values as $field => $value) { - $value = Type::getType($this->class->fieldMappings[$field]->type)->convertToPHPValue($value, $this->platform); + $value = $this->getType($this->class->fieldMappings[$field]->type)->convertToPHPValue($value, $this->platform); $this->class->setFieldValue($entity, $field, $value); } diff --git a/src/Query/Exec/MultiTableDeleteExecutor.php b/src/Query/Exec/MultiTableDeleteExecutor.php index 6096462c7d9..121f2db7fda 100644 --- a/src/Query/Exec/MultiTableDeleteExecutor.php +++ b/src/Query/Exec/MultiTableDeleteExecutor.php @@ -6,7 +6,6 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Query\AST; use Doctrine\ORM\Query\AST\DeleteStatement; use Doctrine\ORM\Query\SqlWalker; @@ -90,7 +89,7 @@ public function __construct(AST\Node $AST, SqlWalker $sqlWalker) $columnDefinitions[$idColumnName] = [ 'name' => $idColumnName, 'notnull' => true, - 'type' => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)), + 'type' => $em->getConfiguration()->getTypeRegistry()->get(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)), ]; } diff --git a/src/Query/Exec/MultiTableUpdateExecutor.php b/src/Query/Exec/MultiTableUpdateExecutor.php index dab1b6172f9..c369907da9d 100644 --- a/src/Query/Exec/MultiTableUpdateExecutor.php +++ b/src/Query/Exec/MultiTableUpdateExecutor.php @@ -6,7 +6,6 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Query\AST; use Doctrine\ORM\Query\AST\UpdateStatement; use Doctrine\ORM\Query\ParameterTypeInferer; @@ -130,7 +129,7 @@ public function __construct(AST\Node $AST, SqlWalker $sqlWalker) $columnDefinitions[$idColumnName] = [ 'name' => $idColumnName, 'notnull' => true, - 'type' => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)), + 'type' => $em->getConfiguration()->getTypeRegistry()->get(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)), ]; } diff --git a/src/Query/ResultSetMappingBuilder.php b/src/Query/ResultSetMappingBuilder.php index 726564a3f1b..89cd8d906c1 100644 --- a/src/Query/ResultSetMappingBuilder.php +++ b/src/Query/ResultSetMappingBuilder.php @@ -4,7 +4,6 @@ namespace Doctrine\ORM\Query; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Internal\SQLResultCasing; use Doctrine\ORM\Mapping\ClassMetadata; @@ -253,7 +252,7 @@ public function generateSelectClause(array $tableAliases = []): string $classFieldMapping = $class->fieldMappings[$fieldName]; $columnSql = $tableAlias . '.' . $classFieldMapping->columnName; - $type = Type::getType($classFieldMapping->type); + $type = $this->em->getConfiguration()->getTypeRegistry()->get($classFieldMapping->type); $columnSql = $type->convertToPHPValueSQL($columnSql, $this->em->getConnection()->getDatabasePlatform()); $sql .= $columnSql; diff --git a/src/Query/SqlWalker.php b/src/Query/SqlWalker.php index 897d4d002f7..a63261ca61e 100644 --- a/src/Query/SqlWalker.php +++ b/src/Query/SqlWalker.php @@ -177,6 +177,16 @@ public function getEntityManager(): EntityManagerInterface return $this->em; } + private function getType(string $name): Type + { + return $this->em->getConfiguration()->getTypeRegistry()->get($name); + } + + private function hasType(string $name): bool + { + return $this->em->getConfiguration()->getTypeRegistry()->has($name); + } + /** * Gets the information about a single query component. * @@ -1290,7 +1300,7 @@ public function walkSelectExpression(AST\SelectExpression $selectExpression): st $columnAlias = $this->getSQLColumnAlias($fieldMapping->columnName); $col = $sqlTableAlias . '.' . $columnName; - $type = Type::getType($fieldMapping->type); + $type = $this->getType($fieldMapping->type); $col = $type->convertToPHPValueSQL($col, $this->conn->getDatabasePlatform()); $sql .= $col . ' AS ' . $columnAlias; @@ -1338,7 +1348,7 @@ public function walkSelectExpression(AST\SelectExpression $selectExpression): st break; } - $this->rsm->addScalarResult($columnAlias, $resultAlias, Type::getTypeRegistry()->lookupName($expr->getReturnType())); + $this->rsm->addScalarResult($columnAlias, $resultAlias, $this->em->getConfiguration()->getTypeRegistry()->lookupName($expr->getReturnType())); break; @@ -1416,7 +1426,7 @@ public function walkObjectExpression(string $dqlAlias, array $partialFieldSet, s $col = $sqlTableAlias . '.' . $quotedColumnName; - $type = Type::getType($mapping->type); + $type = $this->getType($mapping->type); $col = $type->convertToPHPValueSQL($col, $this->platform); $sqlParts[] = $col . ' AS ' . $columnAlias; @@ -1451,7 +1461,7 @@ public function walkObjectExpression(string $dqlAlias, array $partialFieldSet, s $col = $sqlTableAlias . '.' . $quotedColumnName; - $type = Type::getType($mapping->type); + $type = $this->getType($mapping->type); $col = $type->convertToPHPValueSQL($col, $this->platform); $sqlParts[] = $col . ' AS ' . $columnAlias; @@ -1556,7 +1566,7 @@ public function walkNewObject(AST\NewObjectExpression $newObjectExpression, stri $fieldType = $fieldMapping->type; $col = trim($e->dispatch($this)); - $type = Type::getType($fieldType); + $type = $this->getType($fieldType); $col = $type->convertToPHPValueSQL($col, $this->platform); $sqlSelectExpressions[] = $col . ' AS ' . $columnAlias; @@ -2189,8 +2199,8 @@ public function walkInputParameter(AST\InputParameter $inputParam): string if ($parameter) { $type = $parameter->getType(); - if (is_string($type) && Type::hasType($type)) { - return Type::getType($type)->convertToDatabaseValueSQL('?', $this->platform); + if (is_string($type) && $this->hasType($type)) { + return $this->getType($type)->convertToDatabaseValueSQL('?', $this->platform); } } diff --git a/src/Tools/Pagination/LimitSubqueryWalker.php b/src/Tools/Pagination/LimitSubqueryWalker.php index 3fb0eeed5fc..403b36c2e85 100644 --- a/src/Tools/Pagination/LimitSubqueryWalker.php +++ b/src/Tools/Pagination/LimitSubqueryWalker.php @@ -4,7 +4,6 @@ namespace Doctrine\ORM\Tools\Pagination; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Query; use Doctrine\ORM\Query\AST\Functions\IdentityFunction; use Doctrine\ORM\Query\AST\Node; @@ -51,7 +50,7 @@ public function walkSelectStatement(SelectStatement $selectStatement): void $query->setHint( self::IDENTIFIER_TYPE, - Type::getType($rootClass->fieldMappings[$identifier]->type), + $query->getEntityManager()->getConfiguration()->getTypeRegistry()->get($rootClass->fieldMappings[$identifier]->type), ); $query->setHint(self::FORCE_DBAL_TYPE_CONVERSION, true); diff --git a/src/Tools/SchemaValidator.php b/src/Tools/SchemaValidator.php index e2731171f62..0f9bc80786f 100644 --- a/src/Tools/SchemaValidator.php +++ b/src/Tools/SchemaValidator.php @@ -111,7 +111,7 @@ public function validateClass(ClassMetadata $class): array $cmf = $this->em->getMetadataFactory(); foreach ($class->fieldMappings as $fieldName => $mapping) { - if (! Type::hasType($mapping->type)) { + if (! $this->em->getConfiguration()->getTypeRegistry()->has($mapping->type)) { $ce[] = "The field '" . $class->name . '#' . $fieldName . "' uses a non-existent type '" . $mapping->type . "'."; } } @@ -332,7 +332,7 @@ function (FieldMapping $fieldMapping) use ($class): string|null { $propertyType = $class->propertyAccessors[$fieldName]->getUnderlyingReflector()->getType(); // If the field type is not a built-in type, we cannot check it - if (! Type::hasType($fieldMapping->type)) { + if (! $this->em->getConfiguration()->getTypeRegistry()->has($fieldMapping->type)) { return null; } @@ -341,7 +341,7 @@ function (FieldMapping $fieldMapping) use ($class): string|null { return null; } - $metadataFieldType = $this->findBuiltInType(Type::getType($fieldMapping->type)); + $metadataFieldType = $this->findBuiltInType($this->em->getConfiguration()->getTypeRegistry()->get($fieldMapping->type)); //If the metadata field type is not a mapped built-in type, we cannot check it if ($metadataFieldType === null) { diff --git a/src/Utility/PersisterHelper.php b/src/Utility/PersisterHelper.php index 248f4b28c53..8fbc1b6629c 100644 --- a/src/Utility/PersisterHelper.php +++ b/src/Utility/PersisterHelper.php @@ -7,7 +7,6 @@ use BackedEnum; use Doctrine\DBAL\ArrayParameterType; use Doctrine\DBAL\ParameterType; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Proxy\DefaultProxyClassNameResolver; @@ -160,17 +159,17 @@ public static function inferParameterTypes( } if (is_array($value)) { - return array_map(self::getArrayBindingType(...), $types); + return array_map(static fn ($t) => self::getArrayBindingType($t, $em), $types); } return $types; } /** @phpstan-return ArrayParameterType::* */ - private static function getArrayBindingType(ParameterType|int|string $type): ArrayParameterType|int + private static function getArrayBindingType(ParameterType|int|string $type, EntityManagerInterface $em): ArrayParameterType|int { if (! $type instanceof ParameterType) { - $type = Type::getType((string) $type)->getBindingType(); + $type = $em->getConfiguration()->getTypeRegistry()->get((string) $type)->getBindingType(); } return match ($type) { From 460fdc90a9c63b67f5aeb39f16e0a07c099d122c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Fri, 3 Apr 2026 10:26:28 +0200 Subject: [PATCH 2/2] Store TypeRegistry in property in SqlWalker instead of private helper methods Replace getType()/hasType() helpers with a $typeRegistry property initialized in the constructor, avoiding repeated getConfiguration()->getTypeRegistry() chain calls. --- src/Query/SqlWalker.php | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/Query/SqlWalker.php b/src/Query/SqlWalker.php index a63261ca61e..112e420f89f 100644 --- a/src/Query/SqlWalker.php +++ b/src/Query/SqlWalker.php @@ -8,7 +8,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\LockMode; use Doctrine\DBAL\Platforms\AbstractPlatform; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\TypeRegistry; use Doctrine\Deprecations\Deprecation; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadata; @@ -140,6 +140,8 @@ class SqlWalker */ private readonly QuoteStrategy $quoteStrategy; + private readonly TypeRegistry $typeRegistry; + /** @phpstan-param array $queryComponents The query components (symbol table). */ public function __construct( private readonly Query $query, @@ -151,6 +153,7 @@ public function __construct( $this->conn = $this->em->getConnection(); $this->platform = $this->conn->getDatabasePlatform(); $this->quoteStrategy = $this->em->getConfiguration()->getQuoteStrategy(); + $this->typeRegistry = $this->em->getConfiguration()->getTypeRegistry(); } /** @@ -177,16 +180,6 @@ public function getEntityManager(): EntityManagerInterface return $this->em; } - private function getType(string $name): Type - { - return $this->em->getConfiguration()->getTypeRegistry()->get($name); - } - - private function hasType(string $name): bool - { - return $this->em->getConfiguration()->getTypeRegistry()->has($name); - } - /** * Gets the information about a single query component. * @@ -1300,7 +1293,7 @@ public function walkSelectExpression(AST\SelectExpression $selectExpression): st $columnAlias = $this->getSQLColumnAlias($fieldMapping->columnName); $col = $sqlTableAlias . '.' . $columnName; - $type = $this->getType($fieldMapping->type); + $type = $this->typeRegistry->get($fieldMapping->type); $col = $type->convertToPHPValueSQL($col, $this->conn->getDatabasePlatform()); $sql .= $col . ' AS ' . $columnAlias; @@ -1348,7 +1341,7 @@ public function walkSelectExpression(AST\SelectExpression $selectExpression): st break; } - $this->rsm->addScalarResult($columnAlias, $resultAlias, $this->em->getConfiguration()->getTypeRegistry()->lookupName($expr->getReturnType())); + $this->rsm->addScalarResult($columnAlias, $resultAlias, $this->typeRegistry->lookupName($expr->getReturnType())); break; @@ -1426,7 +1419,7 @@ public function walkObjectExpression(string $dqlAlias, array $partialFieldSet, s $col = $sqlTableAlias . '.' . $quotedColumnName; - $type = $this->getType($mapping->type); + $type = $this->typeRegistry->get($mapping->type); $col = $type->convertToPHPValueSQL($col, $this->platform); $sqlParts[] = $col . ' AS ' . $columnAlias; @@ -1461,7 +1454,7 @@ public function walkObjectExpression(string $dqlAlias, array $partialFieldSet, s $col = $sqlTableAlias . '.' . $quotedColumnName; - $type = $this->getType($mapping->type); + $type = $this->typeRegistry->get($mapping->type); $col = $type->convertToPHPValueSQL($col, $this->platform); $sqlParts[] = $col . ' AS ' . $columnAlias; @@ -1566,7 +1559,7 @@ public function walkNewObject(AST\NewObjectExpression $newObjectExpression, stri $fieldType = $fieldMapping->type; $col = trim($e->dispatch($this)); - $type = $this->getType($fieldType); + $type = $this->typeRegistry->get($fieldType); $col = $type->convertToPHPValueSQL($col, $this->platform); $sqlSelectExpressions[] = $col . ' AS ' . $columnAlias; @@ -2199,8 +2192,8 @@ public function walkInputParameter(AST\InputParameter $inputParam): string if ($parameter) { $type = $parameter->getType(); - if (is_string($type) && $this->hasType($type)) { - return $this->getType($type)->convertToDatabaseValueSQL('?', $this->platform); + if (is_string($type) && $this->typeRegistry->has($type)) { + return $this->typeRegistry->get($type)->convertToDatabaseValueSQL('?', $this->platform); } }