Skip to content

Commit e9083a9

Browse files
committed
feature #35773 [Notifier] Change notifier recipient handling (jschaedl)
This PR was squashed before being merged into the 5.2-dev branch. Discussion ---------- [Notifier] Change notifier recipient handling | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #35558 <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | tbd. According to @wouterj's reasoning in #35558 I did the following to merge the `AdminRecipient` with the `Recipient` class: - introduced a `EmailRecipientInterface` with `getEmail(): string` methods - introduced a `RecipientInterface` that is extended by `EmailRecipientInterface` and `SmsRecipientInterface` - changed `Recipient` class which now holds an email and a phone number property and implements the `EmailRecipientInterface` and the `SmsRecipientInterface` - changed `NoRecipient` class which now implements the `RecipientInterface` - removed the `AdminRecipient` and fixed all related type-hints - introduced an `EmailRecipient` and `SmsRecipient` - changed the type-hint of the `$recipient` argument in `NotifierInterface::send()`, `Notifier::getChannels()`, `ChannelInterface::notifiy()` and `ChannelInterface::supports()` to `RecipientInterface` - changed the type hint of the `$recipient` argument in the `as*Message()` of the `EmailNotificationInterface` and `SmsNotificationInterface` which now uses the introduced interfaces - changed the type hint of the `$recipient` argument in the static `fromNotification()` factory methods in `EmailMessage` and `SmsMessage` which now uses the introduced interfaces - changed `EmailChannel` to only support recipients which implement the `EmailRecipientInterface` - changed `SmsChannel` only supports recipients which implement the `SmsRecipientInterface` Commits ------- 588607bdd1 [Notifier] Change notifier recipient handling
2 parents 0d6de85 + 2d09fca commit e9083a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
use Symfony\Component\Notifier\Bridge\Twilio\TwilioTransportFactory;
108108
use Symfony\Component\Notifier\Bridge\Zulip\ZulipTransportFactory;
109109
use Symfony\Component\Notifier\Notifier;
110-
use Symfony\Component\Notifier\Recipient\AdminRecipient;
110+
use Symfony\Component\Notifier\Recipient\Recipient;
111111
use Symfony\Component\PropertyAccess\PropertyAccessor;
112112
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
113113
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
@@ -2098,7 +2098,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
20982098
$notifier = $container->getDefinition('notifier');
20992099
foreach ($config['admin_recipients'] as $i => $recipient) {
21002100
$id = 'notifier.admin_recipient.'.$i;
2101-
$container->setDefinition($id, new Definition(AdminRecipient::class, [$recipient['email'], $recipient['phone']]));
2101+
$container->setDefinition($id, new Definition(Recipient::class, [$recipient['email'], $recipient['phone']]));
21022102
$notifier->addMethodCall('addAdminRecipient', [new Reference($id)]);
21032103
}
21042104
}

0 commit comments

Comments
 (0)