Skip to content

Commit

Permalink
Remove legacy workarounds for Messenger integration
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Oct 31, 2018
1 parent d57c1a3 commit 2dea081
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 112 deletions.
27 changes: 0 additions & 27 deletions DependencyInjection/Compiler/MessengerPass.php

This file was deleted.

9 changes: 3 additions & 6 deletions DependencyInjection/DoctrineExtension.php
Expand Up @@ -10,7 +10,7 @@
use LogicException;
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
use Symfony\Bridge\Doctrine\Form\Type\DoctrineType;
use Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddlewareFactory;
use Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ChildDefinition;
Expand Down Expand Up @@ -390,13 +390,10 @@ protected function ormLoad(array $config, ContainerBuilder $container)
->addTag(ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG);
}

// If the Messenger component is installed and the doctrine transaction middleware factory is available, wire it:
if (interface_exists(MessageBusInterface::class) && class_exists(DoctrineTransactionMiddlewareFactory::class)) {
// If the Messenger component is installed and the doctrine transaction middleware is available, wire it:
if (interface_exists(MessageBusInterface::class) && class_exists(DoctrineTransactionMiddleware::class)) {
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('messenger.xml');

$container->getDefinition('messenger.middleware.doctrine_transaction_middleware')
->replaceArgument(0, $config['default_entity_manager']);
}

/*
Expand Down
2 changes: 0 additions & 2 deletions DoctrineBundle.php
Expand Up @@ -3,7 +3,6 @@
namespace Doctrine\Bundle\DoctrineBundle;

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\EntityListenerPass;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\MessengerPass;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ORM\EntityManager;
Expand Down Expand Up @@ -40,7 +39,6 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new DoctrineValidationPass('orm'));
$container->addCompilerPass(new EntityListenerPass());
$container->addCompilerPass(new ServiceRepositoryCompilerPass());
$container->addCompilerPass(new MessengerPass());
}

/**
Expand Down
11 changes: 3 additions & 8 deletions Resources/config/messenger.xml
Expand Up @@ -4,17 +4,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="doctrine.orm.messenger.middleware_factory.transaction" class="Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddlewareFactory" 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_transaction_middleware" shortcut in message buses middleware config
the "doctrine_transaction" shortcut in message buses middleware config
-->
<service id="messenger.middleware.doctrine_transaction_middleware" class="Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware" abstract="true" public="false">
<factory service="doctrine.orm.messenger.middleware_factory.transaction" method="createMiddleware" />
<argument /> <!-- default entity manager -->
<service id="messenger.middleware.doctrine_transaction" class="Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware" abstract="true" public="false">
<argument type="service" id="doctrine" />
</service>
</services>
</container>
69 changes: 0 additions & 69 deletions Tests/DependencyInjection/Compiler/MessengerPassTest.php

This file was deleted.

0 comments on commit 2dea081

Please sign in to comment.