From 80dace03e18d7ca99387f7d3db7dbf1ea9222b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Zaj=C4=85c?= Date: Mon, 26 Aug 2019 10:06:46 +0200 Subject: [PATCH] Load messenger services independently from ORM layer --- DependencyInjection/DoctrineExtension.php | 12 ++++++------ Tests/DependencyInjection/DoctrineExtensionTest.php | 6 ------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 9a11aa885..47b9a0bfb 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -60,6 +60,8 @@ public function load(array $configs, ContainerBuilder $container) if (! empty($config['dbal'])) { $this->dbalLoad($config['dbal'], $container); + + $this->loadMessengerServices($container); } if (empty($config['orm'])) { @@ -70,10 +72,6 @@ public function load(array $configs, ContainerBuilder $container) throw new LogicException('Configuring the ORM layer requires to configure the DBAL layer as well.'); } - if (! class_exists(Version::class)) { - throw new LogicException('To configure the ORM layer, you must first install the doctrine/orm package.'); - } - $this->ormLoad($config['orm'], $container); } @@ -341,6 +339,10 @@ protected function getConnectionOptions($connection) */ protected function ormLoad(array $config, ContainerBuilder $container) { + if (! class_exists(Version::class)) { + throw new LogicException('To configure the ORM layer, you must first install the doctrine/orm package.'); + } + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('orm.xml'); @@ -399,8 +401,6 @@ protected function ormLoad(array $config, ContainerBuilder $container) $container->registerForAutoconfiguration(ServiceEntityRepositoryInterface::class) ->addTag(ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG); - - $this->loadMessengerServices($container); } /** diff --git a/Tests/DependencyInjection/DoctrineExtensionTest.php b/Tests/DependencyInjection/DoctrineExtensionTest.php index 47f8216e7..c69a4fda1 100644 --- a/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -663,12 +663,6 @@ public function testMessengerIntegration() $config = BundleConfigurationBuilder::createBuilder() ->addBaseConnection() - ->addEntityManager([ - 'default_entity_manager' => 'default', - 'entity_managers' => [ - 'default' => [], - ], - ]) ->build(); $extension->load([$config], $container);