diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index a92b87e2a91..49e131552ba 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -213,6 +213,7 @@ private function initializeAllDoctrineTypeMappings(): void foreach (Type::getTypesMap() as $typeName => $className) { foreach (Type::getType($typeName)->getMappedDatabaseTypes($this) as $dbType) { + $dbType = strtolower($dbType); $this->doctrineTypeMapping[$dbType] = $typeName; } } diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index cf7dc522894..feabb6eb384 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -106,6 +106,40 @@ public function testRegisterDoctrineMappingType(): void self::assertEquals(Types::INTEGER, $this->platform->getDoctrineTypeMapping('foo')); } + public function testCaseInsensitiveDoctrineTypeMappingFromType(): void + { + $type = new class () extends Type { + /** + * {@inheritDoc} + */ + public function getMappedDatabaseTypes(AbstractPlatform $platform): array + { + return ['TESTTYPE']; + } + + public function getName(): string + { + return 'testtype'; + } + + /** + * {@inheritDoc} + */ + public function getSQLDeclaration(array $column, AbstractPlatform $platform): string + { + return $platform->getDecimalTypeDeclarationSQL($column); + } + }; + + if (Type::hasType($type->getName())) { + Type::overrideType($type->getName(), get_class($type)); + } else { + Type::addType($type->getName(), get_class($type)); + } + + self::assertSame($type->getName(), $this->platform->getDoctrineTypeMapping('TeStTyPe')); + } + public function testRegisterUnknownDoctrineMappingType(): void { $this->expectException(Exception::class);