From 6891c1dd91cbbeaa6871e49dab2905efffc8234f Mon Sep 17 00:00:00 2001 From: Axel Guckelsberger Date: Fri, 24 Feb 2017 16:51:58 +0100 Subject: [PATCH 1/3] Added missing events description --- workflow/usage.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/workflow/usage.rst b/workflow/usage.rst index d0e778af401..5d849f8af18 100644 --- a/workflow/usage.rst +++ b/workflow/usage.rst @@ -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..guard`` +* ``workflow..leave`` +* ``workflow..transition`` +* ``workflow..enter`` + +3. Transition- or state-specific events + +You can even listen to only specific transitions or states for a specific workflow: + +* ``workflow..guard.`` +* ``workflow..leave.`` +* ``workflow..transition.`` +* ``workflow..enter.`` + Usage in Twig ------------- From 89f30cda11e1afb062265914044f4deedf07b059 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 27 Feb 2017 09:09:26 +0100 Subject: [PATCH 2/3] Proposed some rewords --- workflow/usage.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/workflow/usage.rst b/workflow/usage.rst index 5d849f8af18..a335977bb0d 100644 --- a/workflow/usage.rst +++ b/workflow/usage.rst @@ -229,23 +229,25 @@ Available 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. +* ``workflow.guard``: occurs just before starting a transition. It allows you to + prevent the transition by calling ``$event->setBlocked(true);`` as shown above. +* ``workflow.leave``: occurs just after an object has left it's current state. +* ``workflow.transition``: occurs just before starting to transition to the new state. +* ``workflow.enter``: occurs just after the object has entered into the new state. 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. +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 +3. Transition or state-specific events -You can even listen to only specific transitions or states for a specific workflow: +You can even listen to some specific transitions or states for a specific workflow: * ``workflow..guard.`` * ``workflow..leave.`` From 96bad83c08b4aafe44d0e1c95c893f9dc4b24efc Mon Sep 17 00:00:00 2001 From: Axel Guckelsberger Date: Mon, 6 Mar 2017 18:58:34 +0100 Subject: [PATCH 3/3] added commented aspects --- workflow/usage.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/workflow/usage.rst b/workflow/usage.rst index a335977bb0d..980d4774886 100644 --- a/workflow/usage.rst +++ b/workflow/usage.rst @@ -229,11 +229,10 @@ Available events The following events are dispatched for all workflows: -* ``workflow.guard``: occurs just before starting a transition. It allows you to - prevent the transition by calling ``$event->setBlocked(true);`` as shown above. -* ``workflow.leave``: occurs just after an object has left it's current state. -* ``workflow.transition``: occurs just before starting to transition to the new state. -* ``workflow.enter``: occurs just after the object has entered into the new state. +* ``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