Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing doctrine_schema_subscriber if doctrine-messenger is not installed #1715

Merged
merged 5 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
}

$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