From 4663a6a8f8ba6c50459e418c5340137bc025ed62 Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Tue, 24 Oct 2023 17:15:00 +0300 Subject: [PATCH] removing doctrine_schema_subscriber and doctrine_schema_listener if symfony/doctrine-messenger is not installed --- DependencyInjection/DoctrineExtension.php | 2 ++ Resources/config/messenger.xml | 12 ++++++------ Tests/DependencyInjection/DoctrineExtensionTest.php | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index c99b9fbe2..1dc23cf03 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -1153,6 +1153,8 @@ private function loadMessengerServices(ContainerBuilder $container): void } $container->removeDefinition('messenger.transport.doctrine.factory'); + $container->removeDefinition('doctrine.orm.messenger.doctrine_schema_subscriber'); + $container->removeDefinition('doctrine.orm.messenger.doctrine_schema_listener'); } private function createArrayAdapterCachePool(ContainerBuilder $container, string $objectManagerName, string $cacheName): string diff --git a/Resources/config/messenger.xml b/Resources/config/messenger.xml index 680255428..aefa40174 100644 --- a/Resources/config/messenger.xml +++ b/Resources/config/messenger.xml @@ -38,19 +38,19 @@ + + + + + - - - - - diff --git a/Tests/DependencyInjection/DoctrineExtensionTest.php b/Tests/DependencyInjection/DoctrineExtensionTest.php index 9b64c5b91..93c9cca84 100644 --- a/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -1064,6 +1064,8 @@ public function testMessengerIntegrationWithoutDoctrineTransport(): void $extension->load([$config], $container); $this->assertFalse($container->hasDefinition('messenger.transport.doctrine.factory')); + $this->assertFalse($container->hasDefinition('doctrine.orm.messenger.doctrine_schema_subscriber')); + $this->assertFalse($container->hasDefinition('doctrine.orm.messenger.doctrine_schema_listener')); $this->assertNotContains('messenger.transport_factory', $container->findTags()); }