Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ebfea8

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: Reword [Scheduler] Periodical triggers timing
2 parentsfe7aeb2 +a85bae7 commit9ebfea8

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

‎scheduler.rst

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,30 @@ defined by PHP datetime functions::
272272
RecurringMessage::every('3 weeks', new Message());
273273
RecurringMessage::every('first Monday of next month', new Message());
274274

275-
$from = new \DateTimeImmutable('13:47', new \DateTimeZone('Europe/Paris'));
276-
$until = '2023-06-12';
277-
RecurringMessage::every('first Monday of next month', new Message(), $from, $until);
278-
279275
..tip::
280276

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

279+
You can also define ``from`` and ``until`` times for your schedule::
280+
281+
// create a message every day at 13:00
282+
$from = new \DateTimeImmutable('13:00', new \DateTimeZone('Europe/Paris'));
283+
RecurringMessage::every('1 day', new Message(), $from);
284+
285+
// create a message every day until a specific date::
286+
$until = '2023-06-12';
287+
RecurringMessage::every('1 day', new Message(), null, $until);
288+
289+
// combine from and until for more precise control
290+
$from = new \DateTimeImmutable('2023-01-01 13:47', new \DateTimeZone('Europe/Paris'));
291+
$until = '2023-06-12';
292+
RecurringMessage::every('first Monday of next month', new Message(), $from, $until);
293+
294+
When starting the scheduler, the message isn't sent to the messenger immediately.
295+
If you don't set a ``from`` parameter, the first frequency period starts from the
296+
moment the scheduler runs. For example, if you start it at 8:33 and the message
297+
is scheduled hourly, it will run at 9:33, 10:33, 11:33, etc.
298+
283299
Custom Triggers
284300
~~~~~~~~~~~~~~~
285301

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp