Skip to content

Commit

Permalink
Add DBTypes that are missing for TypeMapping (#6463)
Browse files Browse the repository at this point in the history
|      Q       |   A
|------------- | -----------
| Type         | bug
| Fixed issues | #6259 

#### Summary
We've got error because of missing DBTypes on SQLSRV. "Unknown database
type sysname requested, Doctrine\DBAL\Platforms\SQLServer2012Platform
may not support it.". Once for 'sysname' and for 'xml'.
  • Loading branch information
patrick1100 authored Aug 14, 2024
1 parent 613798a commit 677746e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1559,12 +1559,14 @@ protected function initializeDoctrineTypeMappings()
'smalldatetime' => Types::DATETIME_MUTABLE,
'smallint' => Types::SMALLINT,
'smallmoney' => Types::INTEGER,
'sysname' => Types::STRING,
'text' => Types::TEXT,
'time' => Types::TIME_MUTABLE,
'tinyint' => Types::SMALLINT,
'uniqueidentifier' => Types::GUID,
'varbinary' => Types::BINARY,
'varchar' => Types::STRING,
'xml' => Types::TEXT,
];
}

Expand Down
6 changes: 6 additions & 0 deletions tests/Platforms/SQLServerPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,12 @@ public function testInitializesDoctrineTypeMappings(): void

self::assertTrue($this->platform->hasDoctrineTypeMappingFor('uniqueidentifier'));
self::assertSame(Types::GUID, $this->platform->getDoctrineTypeMapping('uniqueidentifier'));

self::assertTrue($this->platform->hasDoctrineTypeMappingFor('sysname'));
self::assertSame(Types::STRING, $this->platform->getDoctrineTypeMapping('sysname'));

self::assertTrue($this->platform->hasDoctrineTypeMappingFor('xml'));
self::assertSame(Types::TEXT, $this->platform->getDoctrineTypeMapping('xml'));
}

protected function getBinaryMaxLength(): int
Expand Down

0 comments on commit 677746e

Please sign in to comment.