Skip to content

Commit

Permalink
Merge pull request #980 from Koc/register-clear-middleware
Browse files Browse the repository at this point in the history
Register DoctrineClearEntityManagerMiddleware as a service
  • Loading branch information
alcaeus authored Jun 7, 2019
2 parents 958ec5b + 7050559 commit ad538cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Resources/config/messenger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
<argument type="service" id="doctrine" />
</service>

<!--
The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
the "doctrine_clear_entity_manager" shortcut in message buses middleware config
-->
<service id="messenger.middleware.doctrine_clear_entity_manager" class="Symfony\Bridge\Doctrine\Messenger\DoctrineClearEntityManagerMiddleware" abstract="true" public="false">
<argument type="service" id="doctrine" />
</service>

<!--
The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
the "doctrine_ping_connection" shortcut in message buses middleware config
Expand Down
2 changes: 2 additions & 0 deletions Tests/DependencyInjection/DoctrineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ public function testMessengerIntegration()

$this->assertNotNull($middlewarePrototype = $container->getDefinition('messenger.middleware.doctrine_transaction'));
$this->assertCount(1, $middlewarePrototype->getArguments());
$this->assertNotNull($middlewarePrototype = $container->getDefinition('messenger.middleware.doctrine_clear_entity_manager'));
$this->assertCount(1, $middlewarePrototype->getArguments());
$this->assertNotNull($middlewarePrototype = $container->getDefinition('messenger.middleware.doctrine_ping_connection'));
$this->assertCount(1, $middlewarePrototype->getArguments());
$this->assertNotNull($middlewarePrototype = $container->getDefinition('messenger.middleware.doctrine_close_connection'));
Expand Down

0 comments on commit ad538cb

Please sign in to comment.