Skip to content

Commit 129d704

Browse files
committed
Remove UUID generator strategy
1 parent 3552b4e commit 129d704

File tree

12 files changed

+4
-329
lines changed

12 files changed

+4
-329
lines changed

docs/en/reference/basic-mapping.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,19 +286,12 @@ object ID. The available strategies are:
286286
- ``ALNUM`` - Generates an alpha-numeric string (based on an incrementing value).
287287
- ``CUSTOM`` - Defers generation to an implementation of ``IdGenerator`` specified in the ``class`` option.
288288
- ``INCREMENT`` - Uses another collection to auto increment an integer identifier.
289-
- ``UUID`` - Generates a UUID identifier (deprecated).
290289
- ``NONE`` - Do not generate any identifier. ID must be manually set.
291290

292291
When using the ``AUTO`` strategy in combination with a UUID identifier, the generator can create UUIDs of type 1, type 4,
293292
and type 7 automatically. For all other UUID types, assign the identifier manually in combination with the ``NONE``
294293
strategy.
295294

296-
.. note::
297-
298-
The ``UUID`` generator is deprecated, as it stores UUIDs as strings. It is recommended to use the ``AUTO`` strategy
299-
with a ``uuid`` type identifier field instead. If you need to keep generating string UUIDs, you can use the
300-
``CUSTOM`` strategy with your own generator.
301-
302295
Here is an example how to manually set a string identifier for your documents:
303296

304297
.. configuration-block::
@@ -315,7 +308,7 @@ Here is an example how to manually set a string identifier for your documents:
315308
#[Document]
316309
class MyPersistentClass
317310
{
318-
#[Id(strategy: 'NONE', type: 'string')]
311+
#[Id(strategy: 'NONE')]
319312
public string $id;
320313
321314
//...

src/Id/AbstractIdGenerator.php

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

src/Id/AutoGenerator.php

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

src/Id/IncrementGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* collection. If not specified it defaults to the name of the collection for the
1919
* document.
2020
*/
21-
class IncrementGenerator extends AbstractIdGenerator
21+
class IncrementGenerator implements IdGenerator
2222
{
2323
/** @var string|null */
2424
protected $collection = null;

src/Id/ObjectIdGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use MongoDB\BSON\ObjectId;
99

1010
/** @internal */
11-
final class ObjectIdGenerator extends AbstractIdGenerator
11+
final class ObjectIdGenerator implements IdGenerator
1212
{
1313
public function generate(DocumentManager $dm, object $document): ObjectId
1414
{

src/Id/SymfonyUuidGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use function sprintf;
1818

1919
/** @internal */
20-
final class SymfonyUuidGenerator extends AbstractIdGenerator
20+
final class SymfonyUuidGenerator implements IdGenerator
2121
{
2222
private const SUPPORTED_TYPES = [
2323
1 => UuidV1::class,

src/Id/UuidGenerator.php

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

src/Mapping/ClassMetadata.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,6 @@
306306
*/
307307
public const GENERATOR_TYPE_INCREMENT = 2;
308308

309-
/**
310-
* UUID means Doctrine will generate a uuid for us.
311-
*
312-
* @deprecated without replacement. Use a custom generator or switch to binary UUIDs.
313-
*/
314-
public const GENERATOR_TYPE_UUID = 3;
315-
316309
/**
317310
* ALNUM means Doctrine will generate Alpha-numeric string identifiers, using the INCREMENT
318311
* generator to ensure identifier uniqueness

src/Mapping/ClassMetadataFactory.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Doctrine\ODM\MongoDB\Id\IncrementGenerator;
1717
use Doctrine\ODM\MongoDB\Id\ObjectIdGenerator;
1818
use Doctrine\ODM\MongoDB\Id\SymfonyUuidGenerator;
19-
use Doctrine\ODM\MongoDB\Id\UuidGenerator;
2019
use Doctrine\Persistence\Mapping\AbstractClassMetadataFactory;
2120
use Doctrine\Persistence\Mapping\ClassMetadata as ClassMetadataInterface;
2221
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
@@ -292,14 +291,6 @@ private function completeIdGeneratorMapping(ClassMetadata $class): void
292291

293292
$class->setIdGenerator($incrementGenerator);
294293
break;
295-
case ClassMetadata::GENERATOR_TYPE_UUID:
296-
$uuidGenerator = new UuidGenerator();
297-
if (isset($idGenOptions['salt'])) {
298-
$uuidGenerator->setSalt((string) $idGenOptions['salt']);
299-
}
300-
301-
$class->setIdGenerator($uuidGenerator);
302-
break;
303294
case ClassMetadata::GENERATOR_TYPE_ALNUM:
304295
$alnumGenerator = new AlnumGenerator();
305296
if (isset($idGenOptions['pad'])) {

src/Types/IntIdType.php

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

0 commit comments

Comments
 (0)