Skip to content

Fix customize notification example #13177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions notifier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ Customize Notifications
You can extend the ``Notification`` or ``Recipient`` base classes to
customize their behavior. For instance, you can overwrite the
``getChannels()`` method to only return ``sms`` if the invoice price is
very high and the recipient has a phonenumber::
very high and the recipient has a phone number::

namespace App\Notifier;

Expand All @@ -500,10 +500,10 @@ very high and the recipient has a phonenumber::
&& $recipient instanceof AdminRecipient
&& null !== $recipient->getPhone()
) {
return ['sms', 'email'];
return ['sms'];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is about returning the sms channel only in case the price is high and the recipient has a phone number.

}

return 'email';
return ['email'];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Notification::getChannels(...) methods needs to return an array.

}
}

Expand Down