Skip to content

Commit

Permalink
Deprecate methods related to the annotation driver
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Oct 22, 2022
1 parent 8160e89 commit 59abd6e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Please switch to one of the other mapping drivers. Native attributes which PHP
supports since version 8.0 are probably your best option.

As a consequence, the following methods are deprecated:
- `ORMSetup::createAnnotationMetadataConfiguration`
- `ORMSetup::createDefaultAnnotationDriver`

## Deprecated `Doctrine\ORM\Proxy\Proxy` interface.

Use `Doctrine\Persistence\Proxy` instead to check whether proxies are initialized.
Expand Down
16 changes: 16 additions & 0 deletions lib/Doctrine/ORM/ORMSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ final class ORMSetup
/**
* Creates a configuration with an annotation metadata driver.
*
* @deprecated Use another mapping driver.
*
* @param string[] $paths
*/
public static function createAnnotationMetadataConfiguration(
Expand All @@ -39,6 +41,12 @@ public static function createAnnotationMetadataConfiguration(
?string $proxyDir = null,
?CacheItemPoolInterface $cache = null
): Configuration {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/10098',
'%s is deprecated and will be removed in Doctrine ORM 3.0',
__METHOD__
);
$config = self::createConfiguration($isDevMode, $proxyDir, $cache);
$config->setMetadataDriverImpl(self::createDefaultAnnotationDriver($paths));

Expand All @@ -48,12 +56,20 @@ public static function createAnnotationMetadataConfiguration(
/**
* Adds a new default annotation driver with a correctly configured annotation reader.
*
* @deprecated Use another mapping driver.
*
* @param string[] $paths
*/
public static function createDefaultAnnotationDriver(
array $paths = [],
?CacheItemPoolInterface $cache = null
): AnnotationDriver {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/10098',
'%s is deprecated and will be removed in Doctrine ORM 3.0',
__METHOD__
);
if (! class_exists(AnnotationReader::class)) {
throw new LogicException(sprintf(
'The annotation metadata driver cannot be enabled because the "doctrine/annotations" library'
Expand Down

0 comments on commit 59abd6e

Please sign in to comment.