Skip to content

Commit 352ab1f

Browse files
committed
minor #21212 [Scheduler] Add warning about comma-separated weekdays in PeriodicalTrigger (wazum)
This PR was merged into the 6.4 branch. Discussion ---------- [Scheduler] Add warning about comma-separated weekdays in `PeriodicalTrigger` ### 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 - Added .. caution:: block in the Periodical Triggers section - Shows the problematic usage pattern to avoid - Provides working cron expression alternative: RecurringMessage::cron('5 12 * * 1,4,6', $message) - Includes timezone handling example: RecurringMessage::cron('5 12 * * 1,4,6', $message, 'Europe/Warsaw') Commits ------- 6a007d4 bug #60745 [Scheduler] Add warning about comma-separated weekdays in PeriodicalTrigger
2 parents 85c7c5e + 6a007d4 commit 352ab1f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scheduler.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,16 @@ defined by PHP datetime functions::
286286
RecurringMessage::every('3 weeks', new Message());
287287
RecurringMessage::every('first Monday of next month', new Message());
288288

289+
.. note::
290+
291+
Comma-separated weekdays (e.g., ``'Monday, Thursday, Saturday'``) are not supported
292+
by the ``every()`` method. For multiple weekdays, use cron expressions instead:
293+
294+
.. code-block:: diff
295+
296+
- RecurringMessage::every('Monday, Thursday, Saturday', new Message());
297+
+ RecurringMessage::cron('5 12 * * 1,4,6', new Message());
298+
289299
.. tip::
290300

291301
You can also define periodic tasks using :ref:`the AsPeriodicTask attribute <scheduler-attributes-periodic-task>`.

0 commit comments

Comments
 (0)