Skip to content

Conversation

@wazum
Copy link
Contributor

@wazum wazum commented Jul 17, 2025

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')
@carsonbot carsonbot added this to the 6.4 milestone Jul 17, 2025
@wazum wazum force-pushed the add-scheduler-comma-warning branch from 7cc7412 to 47eed9d Compare July 17, 2025 07:35
@wazum wazum force-pushed the add-scheduler-comma-warning branch from 47eed9d to c974e6d Compare July 17, 2025 08:03
@carsonbot carsonbot changed the title Add warning about comma-separated weekdays in PeriodicalTrigger [Scheduler] Add warning about comma-separated weekdays in PeriodicalTrigger Jul 17, 2025
@OskarStark OskarStark changed the title [Scheduler] Add warning about comma-separated weekdays in PeriodicalTrigger [Scheduler] Add warning about comma-separated weekdays in PeriodicalTrigger Jul 17, 2025
scheduler.rst Outdated
RecurringMessage::every('3 weeks', new Message());
RecurringMessage::every('first Monday of next month', new Message());

.. warning::
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.. warning::
.. note::
scheduler.rst Outdated
Comment on lines 300 to 301
// With timezone (equivalent to the every() method with DateTimeImmutable):
RecurringMessage::cron('5 12 * * 1,4,6', new Message(), 'Europe/Warsaw');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// With timezone (equivalent to the every() method with DateTimeImmutable):
RecurringMessage::cron('5 12 * * 1,4,6', new Message(), 'Europe/Warsaw');
scheduler.rst Outdated
Comment on lines 293 to 298

// Instead of this (not supported):
RecurringMessage::every('Monday, Thursday, Saturday', new Message());

// Use this:
RecurringMessage::cron('5 12 * * 1,4,6', new Message());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// 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());
@javiereguiluz
Copy link
Member

Thanks Wolfgang ... and congrats on your first Symfony Docs contribution 🎉

@javiereguiluz javiereguiluz merged commit 352ab1f into symfony:6.4 Jul 17, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment