diff --git a/workflow/usage.rst b/workflow/usage.rst index d0e778af401..980d4774886 100644 --- a/workflow/usage.rst +++ b/workflow/usage.rst @@ -222,6 +222,37 @@ 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 just before a transition is started and when testing which transitions are available. It allows you to define that the transition is not allowed by calling ``$event->setBlocked(true);`` as shown above. +* ``workflow.leave``: carries the marking with the initial places, occurs just after an object has left it's current state. +* ``workflow.transition``: carries the marking with the current places, occurs just before starting to transition to the new state. +* ``workflow.enter``: carries the marking with the new places, occurs just after the object has entered into the new state. + +2. Workflow-specific events + +All the previous events are also triggered for each workflow individually, so +you can react only to the events of a specific workflow: + +* ``workflow..guard`` +* ``workflow..leave`` +* ``workflow..transition`` +* ``workflow..enter`` + +3. Transition or state-specific events + +You can even listen to some specific transitions or states for a specific workflow: + +* ``workflow..guard.`` +* ``workflow..leave.`` +* ``workflow..transition.`` +* ``workflow..enter.`` + Usage in Twig -------------