Skip to content

Added missing events description #7528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added missing events description
  • Loading branch information
Guite authored Feb 24, 2017
commit 6891c1dd91cbbeaa6871e49dab2905efffc8234f
30 changes: 30 additions & 0 deletions workflow/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,36 @@ could easily enable logging::
$subscriber = new AuditTrailListener($logger);
$dispatcher->addSubscriber($subscriber);

Available events
----------------

1. General events

The following events are dispatched for all workflows:

* ``workflow.guard``: occurs before a transition is started. Allows you to prevent it by calling ``$event->setBlocked(true);`` like shown above.
* ``workflow.leave``: occurs when an object leaves it's current state.
* ``workflow.transition``: occurs when the transition to the new state is launched.
* ``workflow.enter``: occurs when the new state is just defined on the object.

2. Workflow-specific events

All the events are also triggered for each workflow specifically. This allows you to react only for the events of a specific workflow.

* ``workflow.<workflow_name>.guard``
* ``workflow.<workflow_name>.leave``
* ``workflow.<workflow_name>.transition``
* ``workflow.<workflow_name>.enter``

3. Transition- or state-specific events

You can even listen to only specific transitions or states for a specific workflow:

* ``workflow.<workflow_name>.guard.<transition_name>``
* ``workflow.<workflow_name>.leave.<state_name>``
* ``workflow.<workflow_name>.transition.<transition_name>``
* ``workflow.<workflow_name>.enter.<state_name>``

Usage in Twig
-------------

Expand Down