Skip to content

Commit

Permalink
Remove TABLE and UUID strategies (#9045)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Oct 2, 2021
1 parent 18c153e commit d95f304
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 335 deletions.
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ Signatures of overridden methods should be changed accordingly

Method `Doctrine\ORM\EntityManagerInterface#copy()` never got its implementation and is removed in 3.0.

## BC BREAK: Removed classes related to UUID and TABLE generator strategies

The following classes have been removed:
- `Doctrine\ORM\Id\TableGenerator`
- `Doctrine\ORM\Id\UuidGenerator`

Using the `UUID` strategy for generating identifiers is not supported anymore.

# Upgrade to 2.10

## BC Break: Removed `TABLE` id generator strategy
Expand Down
83 changes: 0 additions & 83 deletions lib/Doctrine/ORM/Id/TableGenerator.php

This file was deleted.

47 changes: 0 additions & 47 deletions lib/Doctrine/ORM/Id/UuidGenerator.php

This file was deleted.

12 changes: 0 additions & 12 deletions lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
use Doctrine\ORM\Id\BigIntegerIdentityGenerator;
use Doctrine\ORM\Id\IdentityGenerator;
use Doctrine\ORM\Id\SequenceGenerator;
use Doctrine\ORM\Id\UuidGenerator;
use Doctrine\ORM\Mapping\Exception\CannotGenerateIds;
use Doctrine\ORM\Mapping\Exception\InvalidCustomGenerator;
use Doctrine\ORM\Mapping\Exception\TableGeneratorNotImplementedYet;
use Doctrine\ORM\Mapping\Exception\UnknownGeneratorType;
use Doctrine\Persistence\Mapping\AbstractClassMetadataFactory;
use Doctrine\Persistence\Mapping\ClassMetadata as ClassMetadataInterface;
Expand Down Expand Up @@ -617,16 +615,6 @@ private function completeIdGeneratorMapping(ClassMetadataInfo $class): void
$class->setIdGenerator(new AssignedGenerator());
break;

case ClassMetadata::GENERATOR_TYPE_UUID:
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/7312',
'Mapping for %s: the "UUID" id generator strategy is deprecated with no replacement',
$class->name
);
$class->setIdGenerator(new UuidGenerator());
break;

case ClassMetadata::GENERATOR_TYPE_CUSTOM:
$definition = $class->customGeneratorDefinition;
if ($definition === null) {
Expand Down
40 changes: 0 additions & 40 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Doctrine\Deprecations\Deprecation;
use Doctrine\Instantiator\Instantiator;
use Doctrine\Instantiator\InstantiatorInterface;
use Doctrine\ORM\Cache\Exception\CacheException;
use Doctrine\ORM\Cache\Exception\NonCacheableEntityAssociation;
use Doctrine\ORM\Id\AbstractIdGenerator;
use Doctrine\Persistence\Mapping\ClassMetadata;
Expand Down Expand Up @@ -111,15 +110,6 @@ class ClassMetadataInfo implements ClassMetadata
*/
public const GENERATOR_TYPE_SEQUENCE = 2;

/**
* TABLE means a separate table is used for id generation.
* Offers full portability (in that it results in an exception being thrown
* no matter the platform).
*
* @deprecated no replacement planned
*/
public const GENERATOR_TYPE_TABLE = 3;

/**
* IDENTITY means an identity column is used for id generation. The database
* will fill in the id column on insertion. Platforms that do not support
Expand All @@ -134,14 +124,6 @@ class ClassMetadataInfo implements ClassMetadata
*/
public const GENERATOR_TYPE_NONE = 5;

/**
* UUID means that a UUID/GUID expression is used for id generation. Full
* portability is currently not guaranteed.
*
* @deprecated use an application-side generator instead
*/
public const GENERATOR_TYPE_UUID = 6;

/**
* CUSTOM means that customer will use own ID generator that supposedly work
*/
Expand Down Expand Up @@ -2231,18 +2213,6 @@ public function isIdGeneratorSequence()
return $this->generatorType === self::GENERATOR_TYPE_SEQUENCE;
}

/**
* Checks whether the class uses a table for id generation.
*
* @deprecated
*
* @return false
*/
public function isIdGeneratorTable()
{
return false;
}

/**
* Checks whether the class has a natural identifier/pk (which means it does
* not use any Id generator.
Expand All @@ -2254,16 +2224,6 @@ public function isIdentifierNatural()
return $this->generatorType === self::GENERATOR_TYPE_NONE;
}

/**
* Checks whether the class use a UUID for id generation.
*
* @return bool
*/
public function isIdentifierUuid()
{
return $this->generatorType === self::GENERATOR_TYPE_UUID;
}

/**
* Gets the type of a field.
*
Expand Down
5 changes: 0 additions & 5 deletions lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
namespace Doctrine\ORM\Mapping\Driver;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\Reader;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Annotation;
use Doctrine\ORM\Cache\Exception\CacheException;
use Doctrine\ORM\Events;
use Doctrine\ORM\Id\TableGenerator;
use Doctrine\ORM\Mapping;
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
use Doctrine\ORM\Mapping\MappingException;
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/ORM/Tools/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ class EntityGenerator
ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE => 'SEQUENCE',
ClassMetadataInfo::GENERATOR_TYPE_IDENTITY => 'IDENTITY',
ClassMetadataInfo::GENERATOR_TYPE_NONE => 'NONE',
ClassMetadataInfo::GENERATOR_TYPE_UUID => 'UUID',
ClassMetadataInfo::GENERATOR_TYPE_CUSTOM => 'CUSTOM',
];

Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ORM/Tools/Export/Driver/AbstractExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ protected function _getIdGeneratorTypeString($type)
case ClassMetadataInfo::GENERATOR_TYPE_IDENTITY:
return 'IDENTITY';

case ClassMetadataInfo::GENERATOR_TYPE_UUID:
return 'UUID';

case ClassMetadataInfo::GENERATOR_TYPE_CUSTOM:
return 'CUSTOM';
}
Expand Down
16 changes: 3 additions & 13 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Event/PreFlushEventArgs.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getTableHiLoCurrentValSql\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Id/TableGenerator.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getTableHiLoUpdateNextValSql\\(\\)\\.$#"
count: 1
path: lib/Doctrine/ORM/Id/TableGenerator.php

-
message: "#^Parameter \\#2 \\$discrMap of static method Doctrine\\\\ORM\\\\Internal\\\\Hydration\\\\HydrationException\\:\\:invalidDiscriminatorValue\\(\\) expects array\\<string, string\\>, array\\<int, int\\|string\\> given\\.$#"
count: 1
Expand Down Expand Up @@ -2092,7 +2082,7 @@ parameters:
path: lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php

-
message: "#^Parameter \\#1 \\$type of method Doctrine\\\\ORM\\\\Tools\\\\Export\\\\Driver\\\\AbstractExporter\\:\\:_getIdGeneratorTypeString\\(\\) expects 1\\|2\\|3\\|4\\|5\\|6\\|7, int given\\.$#"
message: "#^Parameter \\#1 \\$type of method Doctrine\\\\ORM\\\\Tools\\\\Export\\\\Driver\\\\AbstractExporter\\:\\:_getIdGeneratorTypeString\\(\\) expects 1\\|2\\|4\\|5\\|7, int given\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/PhpExporter.php

Expand All @@ -2102,7 +2092,7 @@ parameters:
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php

-
message: "#^Parameter \\#1 \\$type of method Doctrine\\\\ORM\\\\Tools\\\\Export\\\\Driver\\\\AbstractExporter\\:\\:_getIdGeneratorTypeString\\(\\) expects 1\\|2\\|3\\|4\\|5\\|6\\|7, int given\\.$#"
message: "#^Parameter \\#1 \\$type of method Doctrine\\\\ORM\\\\Tools\\\\Export\\\\Driver\\\\AbstractExporter\\:\\:_getIdGeneratorTypeString\\(\\) expects 1\\|2\\|4\\|5\\|7, int given\\.$#"
count: 2
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php

Expand All @@ -2112,7 +2102,7 @@ parameters:
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php

-
message: "#^Parameter \\#1 \\$type of method Doctrine\\\\ORM\\\\Tools\\\\Export\\\\Driver\\\\AbstractExporter\\:\\:_getIdGeneratorTypeString\\(\\) expects 1\\|2\\|3\\|4\\|5\\|6\\|7, int given\\.$#"
message: "#^Parameter \\#1 \\$type of method Doctrine\\\\ORM\\\\Tools\\\\Export\\\\Driver\\\\AbstractExporter\\:\\:_getIdGeneratorTypeString\\(\\) expects 1\\|2\\|4\\|5\\|7, int given\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php

Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ includes:

parameters:
ignoreErrors:
# deprecations from doctrine/dbal:3.x
- '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getGuidExpression\(\).$/'

# Fallback logic for DBAL 2
-
message: '/HelperSet constructor expects/'
Expand Down

0 comments on commit d95f304

Please sign in to comment.