File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/Symfony/Component/Notifier/Transport Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \Notifier \Transport ;
13
13
14
+ use Symfony \Component \EventDispatcher \LegacyEventDispatcherProxy ;
15
+ use Symfony \Component \Notifier \Event \MessageEvent ;
14
16
use Symfony \Component \Notifier \Message \MessageInterface ;
17
+ use Symfony \Contracts \EventDispatcher \EventDispatcherInterface ;
15
18
16
19
/**
17
20
* @author Fabien Potencier <fabien@symfony.com>
20
23
*/
21
24
class NullTransport implements TransportInterface
22
25
{
26
+ private $ dispatcher ;
27
+
28
+ public function __construct (EventDispatcherInterface $ dispatcher = null )
29
+ {
30
+ $ this ->dispatcher = LegacyEventDispatcherProxy::decorate ($ dispatcher );
31
+ }
32
+
23
33
public function send (MessageInterface $ message ): void
24
34
{
35
+ if (null !== $ this ->dispatcher ) {
36
+ $ this ->dispatcher ->dispatch (new MessageEvent ($ message ));
37
+ }
25
38
}
26
39
27
40
public function __toString (): string
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ final class NullTransportFactory extends AbstractTransportFactory
26
26
public function create (Dsn $ dsn ): TransportInterface
27
27
{
28
28
if ('null ' === $ dsn ->getScheme ()) {
29
- return new NullTransport ();
29
+ return new NullTransport ($ this -> dispatcher );
30
30
}
31
31
32
32
throw new UnsupportedSchemeException ($ dsn , 'null ' , $ this ->getSupportedSchemes ());
You can’t perform that action at this time.
0 commit comments