Skip to content

Commit c974e6d

Browse files
committed
bug #60745 [Scheduler] Add warning about comma-separated weekdays in PeriodicalTrigger
1 parent 85c7c5e commit c974e6d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scheduler.rst

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

289+
.. warning::
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+
// Instead of this (not supported):
295+
RecurringMessage::every('Monday, Thursday, Saturday', new Message());
296+
297+
// Use this:
298+
RecurringMessage::cron('5 12 * * 1,4,6', new Message());
299+
300+
// With timezone (equivalent to the every() method with DateTimeImmutable):
301+
RecurringMessage::cron('5 12 * * 1,4,6', new Message(), 'Europe/Warsaw');
302+
289303
.. tip::
290304

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

0 commit comments

Comments
 (0)