Skip to content

Commit

Permalink
Merge pull request #1715 from oleg-andreyev/remove-schema-listener
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky authored Oct 24, 2023
2 parents a24a4ab + 4663a6a commit 989b9d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,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
Expand Down
12 changes: 6 additions & 6 deletions Resources/config/messenger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@
<argument type="service" id="logger" />
</service>

<service id="doctrine.orm.messenger.event_subscriber.doctrine_clear_entity_manager" class="Symfony\Bridge\Doctrine\Messenger\DoctrineClearEntityManagerWorkerSubscriber" public="false">
<tag name="kernel.event_subscriber" />
<argument type="service" id="doctrine" />
</service>

<!--
The following service is removed conditionally in DoctrineExtension, if symfony/doctrine-messenger is not installed.
The services below will be removed conditionally in DoctrineExtension, if symfony/doctrine-messenger is not installed.
-->
<service id="messenger.transport.doctrine.factory" class="Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransportFactory" public="false">
<argument type="service" id="doctrine" />
<tag name="messenger.transport_factory" />
</service>

<service id="doctrine.orm.messenger.event_subscriber.doctrine_clear_entity_manager" class="Symfony\Bridge\Doctrine\Messenger\DoctrineClearEntityManagerWorkerSubscriber" public="false">
<tag name="kernel.event_subscriber" />
<argument type="service" id="doctrine" />
</service>

<service id="doctrine.orm.messenger.doctrine_schema_subscriber" class="Symfony\Bridge\Doctrine\SchemaListener\MessengerTransportDoctrineSchemaSubscriber">
<argument type="tagged" tag="messenger.receiver" />
<tag name="doctrine.event_subscriber" />
Expand Down
2 changes: 2 additions & 0 deletions Tests/DependencyInjection/DoctrineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,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());
}

Expand Down

0 comments on commit 989b9d2

Please sign in to comment.