File tree Expand file tree Collapse file tree 6 files changed +12
-4
lines changed Expand file tree Collapse file tree 6 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public function getOptions(): ?MessageOptionsInterface
77
77
/**
78
78
* @return $this
79
79
*/
80
- public function transport (?string $ transport ): self
80
+ public function transport (?string $ transport ): MessageInterface
81
81
{
82
82
$ this ->transport = $ transport ;
83
83
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ public function getOptions(): ?MessageOptionsInterface
102
102
/**
103
103
* @return $this
104
104
*/
105
- public function transport (string $ transport ): self
105
+ public function transport (string $ transport ): MessageInterface
106
106
{
107
107
if (!$ this ->message instanceof Email) {
108
108
throw new LogicException ('Cannot set a Transport on a RawMessage instance. ' );
Original file line number Diff line number Diff line change @@ -25,4 +25,6 @@ public function getSubject(): string;
25
25
public function getOptions (): ?MessageOptionsInterface ;
26
26
27
27
public function getTransport (): ?string ;
28
+
29
+ public function transport (string $ transport ): self ;
28
30
}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function getSubject(): string
83
83
/**
84
84
* @return $this
85
85
*/
86
- public function transport (string $ transport ): self
86
+ public function transport (string $ transport ): MessageInterface
87
87
{
88
88
$ this ->transport = $ transport ;
89
89
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ public function __construct(EventDispatcherInterface $dispatcher = null)
34
34
35
35
public function send (MessageInterface $ message ): SentMessage
36
36
{
37
+ if (null === $ message ->getTransport ()) {
38
+ $ message ->transport ((string ) $ this );
39
+ }
40
+
37
41
if (null !== $ this ->dispatcher ) {
38
42
$ this ->dispatcher ->dispatch (new MessageEvent ($ message ));
39
43
}
Original file line number Diff line number Diff line change @@ -55,8 +55,10 @@ public function supports(MessageInterface $message): bool
55
55
public function send (MessageInterface $ message ): SentMessage
56
56
{
57
57
if (!$ transport = $ message ->getTransport ()) {
58
- foreach ($ this ->transports as $ transport ) {
58
+ foreach ($ this ->transports as $ transportName => $ transport ) {
59
59
if ($ transport ->supports ($ message )) {
60
+ $ message ->transport ($ transportName );
61
+
60
62
return $ transport ->send ($ message );
61
63
}
62
64
}
You can’t perform that action at this time.
0 commit comments