From f5a19136092003d93ef94896a65727ee0cae4885 Mon Sep 17 00:00:00 2001 From: Maxime Helias Date: Thu, 14 Nov 2019 16:46:53 +0100 Subject: [PATCH 1/5] Deprecated alias for common interfaces --- Resources/config/dbal.xml | 8 ++++++-- Resources/config/orm.xml | 4 +++- .../Repository/TestCustomServiceRepoRepository.php | 4 ++-- UPGRADE-1.12.md | 6 ++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Resources/config/dbal.xml b/Resources/config/dbal.xml index 72bc68d5c..df606b92d 100644 --- a/Resources/config/dbal.xml +++ b/Resources/config/dbal.xml @@ -65,8 +65,12 @@ %doctrine.default_entity_manager% - - + + The "%alias_id%" service alias is deprecated, use `Doctrine\Common\Persistence\ManagerRegistry` instead. + + + The "%alias_id%" service alias is deprecated, use `Doctrine\Common\Persistence\ManagerRegistry` instead. + diff --git a/Resources/config/orm.xml b/Resources/config/orm.xml index 1dd89afc3..349949749 100644 --- a/Resources/config/orm.xml +++ b/Resources/config/orm.xml @@ -75,7 +75,9 @@ - + + The "%alias_id%" service alias is deprecated, use `Doctrine\ORM\EntityManagerInterface` instead. + diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoRepository.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoRepository.php index 8abc532cc..71b24ce9d 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoRepository.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoRepository.php @@ -2,13 +2,13 @@ namespace Fixtures\Bundles\RepositoryServiceBundle\Repository; -use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Common\Persistence\ManagerRegistry; use Fixtures\Bundles\RepositoryServiceBundle\Entity\TestCustomServiceRepoEntity; class TestCustomServiceRepoRepository extends ServiceEntityRepository { - public function __construct(Registry $registry) + public function __construct(ManagerRegistry $registry) { parent::__construct($registry, TestCustomServiceRepoEntity::class); } diff --git a/UPGRADE-1.12.md b/UPGRADE-1.12.md index 2ed54db24..c18099699 100644 --- a/UPGRADE-1.12.md +++ b/UPGRADE-1.12.md @@ -9,3 +9,9 @@ configuring caches through it has been deprecated. If you are using anything other than the `pool` or `id` cache types, please update your configuration to either use symfony/cache through the `pool` type or configure your cache services manually and use the `service` type. + +Service aliases +--------------- + + * Deprecated the `Symfony\Bridge\Doctrine\RegistryInterface` and `Doctrine\Bundle\DoctrineBundle\Registry` service alias, use `Doctrine\Common\Persistence\ManagerRegistry` instead. + * Deprecated the `Doctrine\Common\Persistence\ObjectManager` service alias, use `Doctrine\ORM\EntityManagerInterface` instead. From 777bc396186e4c34a783dd927bb11bee8e848c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Sun, 17 Nov 2019 16:29:29 +0100 Subject: [PATCH 2/5] Fix deprecation failures around doctrine:mapping:import command --- Tests/Command/ImportMappingDoctrineCommandTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/Command/ImportMappingDoctrineCommandTest.php b/Tests/Command/ImportMappingDoctrineCommandTest.php index cefb5a690..e0e6c3b77 100644 --- a/Tests/Command/ImportMappingDoctrineCommandTest.php +++ b/Tests/Command/ImportMappingDoctrineCommandTest.php @@ -14,6 +14,9 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Kernel; +/** + * @group legacy + */ class ImportMappingDoctrineCommandTest extends TestCase { /** @var ImportMappingTestingKernel|null */ From 461cc0a5fccc6d22acd02a4eb4f0aff60f99e1b7 Mon Sep 17 00:00:00 2001 From: fancyweb Date: Sun, 17 Nov 2019 18:46:36 +0100 Subject: [PATCH 3/5] [DoctrineDataCollector] Handle runnable flag --- DataCollector/DoctrineDataCollector.php | 2 ++ Resources/views/Collector/db.html.twig | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/DataCollector/DoctrineDataCollector.php b/DataCollector/DoctrineDataCollector.php index ddc1471d1..f38676160 100644 --- a/DataCollector/DoctrineDataCollector.php +++ b/DataCollector/DoctrineDataCollector.php @@ -137,6 +137,8 @@ public function collect(Request $request, Response $response, Exception $excepti foreach ($this->data['queries'] as &$queries) { foreach ($queries as &$query) { $query['params'] = $this->cloneVar($query['params']); + // To be removed when the required minimum version of symfony/doctrine-bridge is >= 4.4 + $query['runnable'] = $query['runnable'] ?? true; } } diff --git a/Resources/views/Collector/db.html.twig b/Resources/views/Collector/db.html.twig index c8ef49b89..9dc79f6b5 100644 --- a/Resources/views/Collector/db.html.twig +++ b/Resources/views/Collector/db.html.twig @@ -246,9 +246,10 @@
View formatted query -    - - View runnable query + {% if query.runnable %} +    + View runnable query + {% endif %} {% if query.explainable %}    @@ -265,9 +266,11 @@ {{ query.sql|doctrine_pretty_query }}
- + {% if query.runnable %} + + {% endif %} {% if query.explainable %}
From 142f8789323dce1e16c3ef2bd29f2e8ba6a27b1a Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 19 Nov 2019 10:16:40 +0100 Subject: [PATCH 4/5] Use XMLBundle in container tests This removes deprecations that get the build to fail: YAML mappings are deprecated in ORM 2.7 --- Tests/ContainerTest.php | 2 +- Tests/TestCase.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/ContainerTest.php b/Tests/ContainerTest.php index 161a5c580..d5b9d7287 100644 --- a/Tests/ContainerTest.php +++ b/Tests/ContainerTest.php @@ -37,7 +37,7 @@ protected function setUp() public function testContainer() { - $container = $this->createYamlBundleTestContainer(); + $container = $this->createXmlBundleTestContainer(); $this->assertInstanceOf(DbalLogger::class, $container->get('doctrine.dbal.logger')); $this->assertInstanceOf(DoctrineDataCollector::class, $container->get('data_collector.doctrine')); diff --git a/Tests/TestCase.php b/Tests/TestCase.php index 6822f2a33..27cdb59db 100644 --- a/Tests/TestCase.php +++ b/Tests/TestCase.php @@ -25,12 +25,12 @@ protected function setUp() $this->markTestSkipped('Doctrine is not available.'); } - public function createYamlBundleTestContainer() + public function createXmlBundleTestContainer() { $container = new ContainerBuilder(new ParameterBag([ 'kernel.name' => 'app', 'kernel.debug' => false, - 'kernel.bundles' => ['YamlBundle' => 'Fixtures\Bundles\YamlBundle\YamlBundle'], + 'kernel.bundles' => ['XmlBundle' => 'Fixtures\Bundles\XmlBundle\XmlBundle'], 'kernel.cache_dir' => sys_get_temp_dir(), 'kernel.environment' => 'test', 'kernel.root_dir' => __DIR__ . '/../../../../', // src dir @@ -63,10 +63,10 @@ public function createYamlBundleTestContainer() 'entity_managers' => [ 'default' => [ 'mappings' => [ - 'YamlBundle' => [ - 'type' => 'yml', - 'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/YamlBundle/Resources/config/doctrine', - 'prefix' => 'Fixtures\Bundles\YamlBundle\Entity', + 'XmlBundle' => [ + 'type' => 'xml', + 'dir' => __DIR__ . '/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine', + 'prefix' => 'Fixtures\Bundles\XmlBundle\Entity', ], ], ], From 10e53361221a2c89209cfc8652c4023ce3d7ccb6 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 19 Nov 2019 10:23:01 +0100 Subject: [PATCH 5/5] Add number-aware underscore naming strategy --- Resources/config/orm.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Resources/config/orm.xml b/Resources/config/orm.xml index 349949749..336a2ad6a 100644 --- a/Resources/config/orm.xml +++ b/Resources/config/orm.xml @@ -140,6 +140,10 @@ + + CASE_LOWER + true +