From 146194b0341c05098c6f1747a04682a4bdc12d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 18 Aug 2020 20:40:28 +0200 Subject: [PATCH 1/2] Address deprecation of Definition::setPrivate() Services are private by default since symfony/dependency-injection 4.0, which means the deprecated call can safely be dropped. --- DependencyInjection/DoctrineExtension.php | 1 - 1 file changed, 1 deletion(-) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 707495a1c..f0670706b 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -883,7 +883,6 @@ private function createPoolCacheDefinition(ContainerBuilder $container, string $ $definition = $container->register($serviceId, DoctrineProvider::class); $definition->addArgument(new Reference($poolName)); - $definition->setPrivate(true); return $serviceId; } From c18432d5b20f4888ff61b16e85a2ff6b529bf9db Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 25 Jun 2020 09:38:15 +0200 Subject: [PATCH 2/2] Adds support for doctrine/persistence 2.x --- .../Compiler/DoctrineOrmMappingsPass.php | 10 +++++----- Resources/config/dbal.xml | 1 - Tests/DataCollector/DoctrineDataCollectorTest.php | 2 +- composer.json | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php b/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php index 56e5ecac1..e0e213b20 100644 --- a/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php +++ b/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php @@ -59,7 +59,7 @@ public function __construct($driver, array $namespaces, array $managerParameters */ public static function createXmlMappingDriver(array $namespaces, array $managerParameters = [], $enabledParameter = false, array $aliasMap = []) { - $locator = new Definition('Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator', [$namespaces, '.orm.xml']); + $locator = new Definition('Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator', [$namespaces, '.orm.xml']); $driver = new Definition('Doctrine\ORM\Mapping\Driver\XmlDriver', [$locator]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); @@ -80,7 +80,7 @@ public static function createXmlMappingDriver(array $namespaces, array $managerP */ public static function createYamlMappingDriver(array $namespaces, array $managerParameters = [], $enabledParameter = false, array $aliasMap = []) { - $locator = new Definition('Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator', [$namespaces, '.orm.yml']); + $locator = new Definition('Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator', [$namespaces, '.orm.yml']); $driver = new Definition('Doctrine\ORM\Mapping\Driver\YamlDriver', [$locator]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); @@ -101,8 +101,8 @@ public static function createYamlMappingDriver(array $namespaces, array $manager */ public static function createPhpMappingDriver(array $namespaces, array $managerParameters = [], $enabledParameter = false, array $aliasMap = []) { - $locator = new Definition('Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator', [$namespaces, '.php']); - $driver = new Definition('Doctrine\Common\Persistence\Mapping\Driver\PHPDriver', [$locator]); + $locator = new Definition('Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator', [$namespaces, '.php']); + $driver = new Definition('Doctrine\Persistence\Mapping\Driver\PHPDriver', [$locator]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); } @@ -145,7 +145,7 @@ public static function createAnnotationMappingDriver(array $namespaces, array $d */ public static function createStaticPhpMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = []) { - $driver = new Definition('Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver', [$directories]); + $driver = new Definition('Doctrine\Persistence\Mapping\Driver\StaticPHPDriver', [$directories]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); } diff --git a/Resources/config/dbal.xml b/Resources/config/dbal.xml index cb4ae293c..78ea8bf81 100644 --- a/Resources/config/dbal.xml +++ b/Resources/config/dbal.xml @@ -67,7 +67,6 @@ - diff --git a/Tests/DataCollector/DoctrineDataCollectorTest.php b/Tests/DataCollector/DoctrineDataCollectorTest.php index 326913211..6efb3f4a1 100644 --- a/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -23,7 +23,7 @@ public function testCollectEntities() : void $manager = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock(); $config = $this->getMockBuilder('Doctrine\ORM\Configuration')->getMock(); - $factory = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory') + $factory = $this->getMockBuilder('Doctrine\Persistence\Mapping\AbstractClassMetadataFactory') ->setMethods(['getLoadedMetadata'])->getMockForAbstractClass(); $collector = $this->createCollector(['default' => $manager]); diff --git a/composer.json b/composer.json index 76a97d4df..9d16289a9 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "require": { "php": "^7.1 || ^8.0", "doctrine/dbal": "^2.9.0|^3.0", - "doctrine/persistence": "^1.3.3", + "doctrine/persistence": "^1.3.3|^2.0", "doctrine/sql-formatter": "^1.0.1", "symfony/cache": "^4.3.3|^5.0", "symfony/config": "^4.3.3|^5.0",