[Bridge/Doctrine] remove workarounds from the past
This commit is contained in:
parent
78192e776c
commit
385856413c
@ -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
|
||||
-----
|
||||
|
@ -21,13 +21,15 @@ use Symfony\Component\Messenger\Middleware\StackInterface;
|
||||
* Wraps all handlers in a single doctrine transaction.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*
|
||||
* @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;
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <maxime.steinhausser@gmail.com>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ class DoctrineTransactionMiddlewareTest extends MiddlewareTestCase
|
||||
$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()
|
||||
|
@ -28,7 +28,7 @@
|
||||
<argument /> <!-- Bus handler resolver -->
|
||||
</service>
|
||||
|
||||
<service id="messenger.middleware.validation" class="Symfony\Component\Messenger\Middleware\ValidationMiddleware" abstract="true">
|
||||
<service id="messenger.middleware.validation" class="Symfony\Component\Messenger\Middleware\ValidationMiddleware">
|
||||
<argument type="service" id="validator" />
|
||||
</service>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
</service>
|
||||
|
||||
<!-- Logging -->
|
||||
<service id="messenger.middleware.logging" class="Symfony\Component\Messenger\Middleware\LoggingMiddleware" abstract="true">
|
||||
<service id="messenger.middleware.logging" class="Symfony\Component\Messenger\Middleware\LoggingMiddleware">
|
||||
<tag name="monolog.logger" channel="messenger" />
|
||||
<argument type="service" id="logger" />
|
||||
</service>
|
||||
|
Reference in New Issue
Block a user