Skip to content

Commit 2d37190

Browse files
bug #35826 [Notifier] Add correct tags for NullTransportFactory (jschaedl)
This PR was merged into the 5.0 branch. Discussion ---------- [Notifier] Add correct tags for NullTransportFactory | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | - <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | - <!-- required for new features --> I tried to disable the delivery of notifications in `dev` environment with the following configuration: ``` framework: notifier: chatter_transports: slack: 'null://null' texter_transports: twilio: 'null://null' channel_policy: urgent: ['chat/slack', 'sms/twilio'] high: ['email'] medium: ['email'] low: ['email'] ``` While sending the notification like this: ``` $notification = (new Notification()) ->subject('Test subject') ->importance(Notification::IMPORTANCE_URGENT) ->content('Test content') ; $this->notifier->send($notification); ``` I got an `UnsupportedSchemeException`: The "null" scheme is not supported. After some digging I figured out that this Exception occurred because the `NullTransportFactory` was not tagged with the `chatter.transport_factory` and `texter.transport_factory` tags. Which is the reason the `NullTransportFactory` was not injected in the `Transport` class and so the `NullTransport` couldn't be used. This PR should fix this Bug. Commits ------- 1ff5e3c83f [Notifier] Add correct tags for NullTransportFactory
2 parents aad7ae9 + 5b28299 commit 2d37190

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Resources/config/notifier_transports.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
</service>
2828

2929
<service id="notifier.transport_factory.null" class="Symfony\Component\Notifier\Transport\NullTransportFactory" parent="notifier.transport_factory.abstract">
30-
<tag name="notifier.transport_factory" />
30+
<tag name="chatter.transport_factory" />
31+
<tag name="texter.transport_factory" />
3132
</service>
3233
</services>
3334
</container>

0 commit comments

Comments
 (0)