From 385856413ca90e9e1ae3c8f3546fb957d570f061 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 31 Oct 2018 17:56:39 +0100 Subject: [PATCH] [Bridge/Doctrine] remove workarounds from the past --- src/Symfony/Bridge/Doctrine/CHANGELOG.md | 1 + .../DoctrineTransactionMiddleware.php | 4 ++- .../DoctrineTransactionMiddlewareFactory.php | 36 ------------------- .../DoctrineTransactionMiddlewareTest.php | 2 +- .../Resources/config/messenger.xml | 4 +-- 5 files changed, 7 insertions(+), 40 deletions(-) delete mode 100644 src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddlewareFactory.php diff --git a/src/Symfony/Bridge/Doctrine/CHANGELOG.md b/src/Symfony/Bridge/Doctrine/CHANGELOG.md index c980b0f85998c..c333361d4a37f 100644 --- a/src/Symfony/Bridge/Doctrine/CHANGELOG.md +++ b/src/Symfony/Bridge/Doctrine/CHANGELOG.md @@ -7,6 +7,7 @@ CHANGELOG * deprecated injecting `ClassMetadataFactory` in `DoctrineExtractor`, an instance of `EntityManagerInterface` should be injected instead * added support for `simple_array` type + * the `DoctrineTransactionMiddlewareFactory` class has been removed 4.1.0 ----- diff --git a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddleware.php b/src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddleware.php index e0f28ae42eaad..efab98d54f8f1 100644 --- a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddleware.php +++ b/src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddleware.php @@ -21,13 +21,15 @@ * Wraps all handlers in a single doctrine transaction. * * @author Tobias Nyholm + * + * @experimental in 4.2 */ class DoctrineTransactionMiddleware implements MiddlewareInterface { private $managerRegistry; private $entityManagerName; - public function __construct(ManagerRegistry $managerRegistry, ?string $entityManagerName) + public function __construct(ManagerRegistry $managerRegistry, string $entityManagerName = null) { $this->managerRegistry = $managerRegistry; $this->entityManagerName = $entityManagerName; diff --git a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddlewareFactory.php b/src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddlewareFactory.php deleted file mode 100644 index 2e6f424db3682..0000000000000 --- a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddlewareFactory.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Doctrine\Messenger; - -use Symfony\Bridge\Doctrine\ManagerRegistry; - -/** - * Create a Doctrine ORM transaction middleware to be used in a message bus from an entity manager name. - * - * @author Maxime Steinhausser - * - * @final - */ -class DoctrineTransactionMiddlewareFactory -{ - private $managerRegistry; - - public function __construct(ManagerRegistry $managerRegistry) - { - $this->managerRegistry = $managerRegistry; - } - - public function createMiddleware(string $managerName): DoctrineTransactionMiddleware - { - return new DoctrineTransactionMiddleware($this->managerRegistry, $managerName); - } -} diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php index fb7cd87d1d0da..5927a993d1f4a 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php @@ -34,7 +34,7 @@ public function setUp() $managerRegistry = $this->createMock(ManagerRegistry::class); $managerRegistry->method('getManager')->willReturn($this->entityManager); - $this->middleware = new DoctrineTransactionMiddleware($managerRegistry, null); + $this->middleware = new DoctrineTransactionMiddleware($managerRegistry); } public function testMiddlewareWrapsInTransactionAndFlushes() diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml index 19b234d591fa7..ef4ae3051a727 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml @@ -28,7 +28,7 @@ - + @@ -37,7 +37,7 @@ - +