Skip to content

Commit

Permalink
removing doctrine_schema_subscriber and doctrine_schema_listener if s…
Browse files Browse the repository at this point in the history
…ymfony/doctrine-messenger is not installed
  • Loading branch information
oleg-andreyev committed Oct 24, 2023
1 parent f549108 commit 4663a6a
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 @@ -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');

Check warning on line 1157 in DependencyInjection/DoctrineExtension.php

View check run for this annotation

Codecov / codecov/patch

DependencyInjection/DoctrineExtension.php#L1156-L1157

Added lines #L1156 - L1157 were not covered by tests
}

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 @@ -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());
}

Expand Down

0 comments on commit 4663a6a

Please sign in to comment.