Skip to content

Commit

Permalink
bug #33706 [Mailer][Messenger] ensure legacy event dispatcher compati…
Browse files Browse the repository at this point in the history
…bility (xabbuh)

This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer][Messenger] ensure legacy event dispatcher compatibility

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

4fcc1bc ensure legacy event dispatcher compatibility
  • Loading branch information
fabpot committed Sep 25, 2019
2 parents 479d8ee + 4fcc1bc commit 29a54c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Symfony/Component/Mailer/Transport/AbstractTransport.php
Expand Up @@ -14,6 +14,7 @@
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Component\Mailer\DelayedSmtpEnvelope;
use Symfony\Component\Mailer\Event\MessageEvent;
use Symfony\Component\Mailer\Exception\TransportException;
Expand All @@ -36,7 +37,7 @@ abstract class AbstractTransport implements TransportInterface

public function __construct(EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{
$this->dispatcher = $dispatcher;
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
$this->logger = $logger ?: new NullLogger();
}

Expand Down
Expand Up @@ -13,6 +13,7 @@

use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Event\SendMessageToTransportsEvent;
use Symfony\Component\Messenger\Stamp\ReceivedStamp;
Expand All @@ -38,7 +39,7 @@ class SendMessageMiddleware implements MiddlewareInterface
public function __construct(SendersLocatorInterface $sendersLocator, EventDispatcherInterface $eventDispatcher = null)
{
$this->sendersLocator = $sendersLocator;
$this->eventDispatcher = $eventDispatcher;
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
$this->logger = new NullLogger();
}

Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Messenger/Worker.php
Expand Up @@ -13,6 +13,7 @@

use Psr\Log\LoggerInterface;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
use Symfony\Component\Messenger\Event\WorkerMessageHandledEvent;
use Symfony\Component\Messenger\Event\WorkerMessageReceivedEvent;
Expand Down Expand Up @@ -51,7 +52,7 @@ public function __construct(array $receivers, MessageBusInterface $bus, array $r
$this->receivers = $receivers;
$this->bus = $bus;
$this->retryStrategies = $retryStrategies;
$this->eventDispatcher = $eventDispatcher;
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
$this->logger = $logger;
}

Expand Down

0 comments on commit 29a54c5

Please sign in to comment.