File tree 1 file changed +25
-0
lines changed
Filter options
1 file changed +25
-0
lines changed
Original file line number Diff line number Diff line change @@ -381,11 +381,36 @@ order:
381
381
* ``workflow.[workflow name].announce ``
382
382
* ``workflow.[workflow name].announce.[transition name] ``
383
383
384
+ You can avoid triggering those events by using the context::
385
+
386
+ $workflow->apply($subject, $transitionName, [Workflow::DISABLE_ANNOUNCE_EVENT => true]);
387
+
388
+ .. versionadded :: 5.1
389
+
390
+ The ``Workflow::DISABLE_ANNOUNCE_EVENT `` constant was introduced in Symfony 5.1.
391
+
392
+ .. versionadded :: 5.2
393
+
394
+ In Symfony 5.2, the context is accessible in all events::
395
+
396
+ // $context must be an array
397
+ $context = ['context_key' => 'context_value'];
398
+ $workflow->apply($subject, $transitionName, $context);
399
+
400
+ // in an event listener
401
+ $context = $event->getContext(); // returns ['context']
402
+
384
403
.. note ::
385
404
386
405
The leaving and entering events are triggered even for transitions that stay
387
406
in same place.
388
407
408
+ .. note ::
409
+
410
+ If you initialize the marking by calling ``$workflow->getMarking($object); ``,
411
+ then the ``workflow.[workflow_name].entered.[initial_place_name] `` event will
412
+ be called with the default context (``Workflow::DEFAULT_INITIAL_CONTEXT ``).
413
+
389
414
Here is an example of how to enable logging for every time a "blog_publishing"
390
415
workflow leaves a place::
391
416
You can’t perform that action at this time.
0 commit comments