-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Scheduler] Add warning about comma-separated weekdays in PeriodicalTrigger
#21212
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
Conversation
7cc7412
to
47eed9d
Compare
47eed9d
to
c974e6d
Compare
PeriodicalTrigger
scheduler.rst
Outdated
@@ -286,6 +286,20 @@ defined by PHP datetime functions:: | |||
RecurringMessage::every('3 weeks', new Message()); | |||
RecurringMessage::every('first Monday of next month', new Message()); | |||
|
|||
.. warning:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. warning:: | |
.. note:: |
scheduler.rst
Outdated
// With timezone (equivalent to the every() method with DateTimeImmutable): | ||
RecurringMessage::cron('5 12 * * 1,4,6', new Message(), 'Europe/Warsaw'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// With timezone (equivalent to the every() method with DateTimeImmutable): | |
RecurringMessage::cron('5 12 * * 1,4,6', new Message(), 'Europe/Warsaw'); |
scheduler.rst
Outdated
|
||
// Instead of this (not supported): | ||
RecurringMessage::every('Monday, Thursday, Saturday', new Message()); | ||
|
||
// Use this: | ||
RecurringMessage::cron('5 12 * * 1,4,6', new Message()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Instead of this (not supported): | |
RecurringMessage::every('Monday, Thursday, Saturday', new Message()); | |
// Use this: | |
RecurringMessage::cron('5 12 * * 1,4,6', new Message()); | |
.. code-block:: diff | |
- RecurringMessage::every('Monday, Thursday, Saturday', new Message()); | |
+ RecurringMessage::cron('5 12 * * 1,4,6', new Message()); |
…PeriodicalTrigger
c974e6d
to
6a007d4
Compare
Thanks Wolfgang ... and congrats on your first Symfony Docs contribution 🎉 |
Issue
symfony/symfony#60745
Users attempt to use comma-separated weekdays like "Monday, Thursday, Saturday" with RecurringMessage::every(), which causes silent failures due to PHP's DateInterval::createFromDateString()
Solution
Added a caution note in the PeriodicalTrigger section warning users about this limitation and providing the correct alternative using cron expressions.
Changes