Skip to content

Commit b3b4c34

Browse files
committed
minor #19431 [Scheduler] Add AbstractDecoratedTrigger (alexandre-daubois)
This PR was merged into the 6.4 branch. Discussion ---------- [Scheduler] Add `AbstractDecoratedTrigger` Fix #18649 Commits ------- 968bede [Scheduler] Add `AbstractDecoratedTrigger`
2 parents dbbccda + 968bede commit b3b4c34

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scheduler.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@ the frequency of the message. Symfony provides different types of triggers:
151151
:class:`Symfony\\Component\\Scheduler\\Trigger\\PeriodicalTrigger`
152152
A trigger that uses a ``DateInterval`` to determine the next run date.
153153

154+
The :class:`Symfony\\Component\\Scheduler\\Trigger\\JitterTrigger` and
155+
:class:`Symfony\\Component\\Scheduler\\Trigger\\ExcludeTimeTrigger` are decorators
156+
and modify the behavior of the trigger they wrap. You can get the decorated
157+
trigger as well as the decorators by calling the
158+
:method:`Symfony\\Component\\Scheduler\\Trigger\\AbstractDecoratedTrigger::inner`
159+
and :method:`Symfony\\Component\\Scheduler\\Trigger\\AbstractDecoratedTrigger::decorators`
160+
methods::
161+
162+
$trigger = new ExcludeTimeTrigger(new JitterTrigger(CronExpressionTrigger::fromSpec('#midnight', new MyMessage()));
163+
164+
$trigger->inner(); // CronExpressionTrigger
165+
$trigger->decorators(); // [ExcludeTimeTrigger, JitterTrigger]
166+
167+
.. versionadded:: 6.4
168+
169+
The :method:`Symfony\\Component\\Scheduler\\Trigger\\AbstractDecoratedTrigger::inner`
170+
and :method:`Symfony\\Component\\Scheduler\\Trigger\\AbstractDecoratedTrigger::decorators`
171+
methods were introduced in Symfony 6.4.
172+
154173
Most of them can be created via the :class:`Symfony\\Component\\Scheduler\\RecurringMessage`
155174
class, as shown in the following examples.
156175

0 commit comments

Comments
 (0)