8000 bug #39113 [DoctrineBridge] drop binary variants of UID types (nicola… · symfony/symfony@c13d5b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit c13d5b5

Browse files
committed
bug #39113 [DoctrineBridge] drop binary variants of UID types (nicolas-grekas)
This PR was merged into the 5.2 branch. Discussion ---------- [DoctrineBridge] drop binary variants of UID types | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #39112 | License | MIT | Doc PR | - #39112 made me realize that when the DB engine doesn't have a native UUID/GUID type, there's no benefit to representing ULIDs as UUIDs. This PR proposes to use the native GUID type for both UUIDs and ULIDs only when the DB engine provides such a type, and to use `BINARY(16)` when the DB engine doesn't have a native GUID type. This leaves us in a situation where, whether the DB engine supports GUID natively or not, UUID and ULID are always stored in the most compact format. This makes the "binary" variants useless. MySQL 8 has [functions](https://mysqlserverteam.com/mysql-8-0-uuid-support/) to deal with binary GUID, and so does [SQLite](https://sqlite.org/src/file/ext/misc/uuid.c). Commits ------- bdfc205 [DoctrineBridge] drop binary variants of UID types
2 parents de09329 + bdfc205 commit c13d5b5

File tree

1 8000 0 files changed

+19
-391
lines changed

10 files changed

+19
-391
lines changed

src/Symfony/Bridge/Doctrine/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
5.2.0
55
-----
66

7-
* added support for symfony/uid as `UlidType`, `UuidType`, `UlidBinaryType` and `UuidBinaryType` as Doctrine types
7+
* added support for symfony/uid as `UlidType` and `UuidType` as Doctrine types
88
* added `UlidGenerator`, `UUidV1Generator`, `UuidV4Generator` and `UuidV6Generator`
99

1010
5.0.0

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterUidTypePass.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass;
1313

14-
use Symfony\Bridge\Doctrine\Types\UlidBinaryType;
1514
use Symfony\Bridge\Doctrine\Types\UlidType;
16-
use Symfony\Bridge\Doctrine\Types\UuidBinaryType;
1715
use Symfony\Bridge\Doctrine\Types\UuidType;
1816
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1917
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -40,14 +38,6 @@ public function process(ContainerBuilder $container)
4038
$typeDefinition['ulid'] = ['class' => UlidType::class];
4139
}
4240

43-
if (!isset($typeDefinition['uuid_binary'])) {
44-
$typeDefinition['uuid_binary'] = ['class' => UuidBinaryType::class];
45-
}
46-
47-
if (!isset($typeDefinition['ulid_binary'])) {
48-
$typeDefinition['ulid_binary'] = ['class' => UlidBinaryType::class];
49-
}
50-
5141
$container->setParameter('doctrine.dbal.connection_factory.types', $typeDefinition);
5242
}
5343
}

src/Symfony/Bridge/Doctrine/Tests/Types/UlidBinaryTypeTest.php

Lines changed: 0 additions & 114 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Tests/Types/UlidTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public static function setUpBeforeClass(): void
3737
protected function setUp(): void
3838
{
3939
$this->platform = $this->createMock(AbstractPlatform::class);
40+
$this->platform
41+
->method('hasNativeGuidType')
42+
->willReturn(true);
4043
$this->platform
4144
->method('getGuidTypeDeclarationSQL')
4245
->willReturn('DUMMYVARCHAR()');

src/Symfony/Bridge/Doctrine/Tests/Types/UuidBinaryTypeTest.php

Lines changed: 0 additions & 123 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Tests/Types/UuidTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public static function setUpBeforeClass(): void
3737
protected function setUp(): void
3838
{
3939
$this->platform = $this->createMock(AbstractPlatform::class);
40+
$this->platform
41+
->method('hasNativeGuidType')
42+
->willReturn(true);
4043
$this->platform
4144
->method('getGuidTypeDeclarationSQL')
4245
->willReturn('DUMMYVARCHAR()');

src/Symfony/Bridge/Doctrine/Types/AbstractBinaryUidType.php

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0