@@ -189,53 +189,79 @@ Each step has three events that are fired in order:
189189* An event for the workflow concerned;
190190* An event for the workflow concerned with the specific transition or place name.
191191
192- The following events are dispatched:
192+ When a state transition is initiated, the events are dispatched in the following
193+ order:
193194
194- * ``workflow.guard ``
195- * ``workflow.[workflow name].guard ``
196- * ``workflow.[workflow name].guard.[transition name] ``
195+ ``workflow.guard ``
196+ Validate whether the transition is allowed at all (:ref: `see below <workflow-usage-guard-events >`).
197+
198+ The three events being dispatched are:
199+
200+ * ``workflow.guard ``
201+ * ``workflow.[workflow name].guard ``
202+ * ``workflow.[workflow name].guard.[transition name] ``
203+
204+ ``workflow.leave ``
205+ The object is about to leave a place.
206+
207+ The three events being dispatched are:
208+
209+ * ``workflow.leave ``
210+ * ``workflow.[workflow name].leave ``
211+ * ``workflow.[workflow name].leave.[place name] ``
212+
213+ ``workflow.transition ``
214+ The object is going through this transition.
197215
198- * ``workflow.leave ``
199- * ``workflow.[workflow name].leave ``
200- * ``workflow.[workflow name].leave.[place name] ``
216+ The three events being dispatched are:
201217
202- * ``workflow.transition ``
203- * ``workflow.[workflow name].transition ``
204- * ``workflow.[workflow name].transition.[transition name] ``
218+ * ``workflow.transition ``
219+ * ``workflow.[workflow name].transition ``
220+ * ``workflow.[workflow name].transition.[transition name] ``
205221
206- * ``workflow.enter ``
207- * `` workflow.[workflow name].enter ``
208- * `` workflow.[workflow name].enter.[place name] ``
222+ ``workflow.enter ``
223+ The object entered a new place. This is the first event where the object
224+ is marked as being in the new place.
209225
210- * ``workflow.entered ``
211- * ``workflow.[workflow name].entered ``
212- * ``workflow.[workflow name].entered.[place name] ``
226+ The three events being dispatched are:
213227
214- * ``workflow.announce ``
215- * ``workflow.[workflow name].announce ``
216- * ``workflow.[workflow name].announce.[transition name] ``
228+ * ``workflow.enter ``
229+ * ``workflow.[workflow name].enter ``
230+ * ``workflow.[workflow name].enter.[place name] ``
217231
218- When a state transition is initiated, the events are fired in the following order:
232+ `` work.flow.entered ``
219233
220- - guard: Validate whether the transition is allowed at all (:ref: `see below <workflow-usage-guard-events >`);
221- - leave: The object is about to leave a place;
222- - transition: The object is going through this transition;
223- - enter: The object entered a new place. This is the first event where the object' is marked as being in the new place;
224- - announce: Triggered once for each workflow that now is available for the object.
234+ Similar to ``workflow.enter ``, except the marking store is updated before this
235+ event (making it a good place to flush data in Doctrine).
236+
237+ The three events being dispatched are:
238+
239+ * ``workflow.entered ``
240+ * ``workflow.[workflow name].entered ``
241+ * ``workflow.[workflow name].entered.[place name] ``
242+
243+ ``workflow.announce ``
244+ Triggered once for each workflow that now is available for the object.
245+
246+ The three events being dispatched are:
247+
248+ * ``workflow.announce ``
249+ * ``workflow.[workflow name].announce ``
250+ * ``workflow.[workflow name].announce.[transition name] ``
225251
226252Here is an example how to enable logging for every time a the "blog_publishing" workflow leaves a place::
227253
228254 use Psr\Log\LoggerInterface;
229255 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
230256 use Symfony\Component\Workflow\Event\Event;
231-
257+
232258 class WorkflowLogger implements EventSubscriberInterface
233259 {
234260 public function __construct(LoggerInterface $logger)
235261 {
236262 $this->logger = $logger;
237263 }
238-
264+
239265 public function onLeave(Event $event)
240266 {
241267 $this->logger->alert(sprintf(
@@ -246,7 +272,7 @@ Here is an example how to enable logging for every time a the "blog_publishing"
246272 implode(', ', $event->getTransition()->getTos())
247273 ));
248274 }
249-
275+
250276 public static function getSubscribedEvents()
251277 {
252278 return array(
@@ -257,14 +283,14 @@ Here is an example how to enable logging for every time a the "blog_publishing"
257283
258284.. _workflow-usage-guard-events :
259285
260- Guard events
286+ Guard Events
261287~~~~~~~~~~~~
262288
263- There are a special kind of events called "Guard events". Their event listeners
264- are invoked every time a call to ``Workflow::can ``, ``Workflow::apply `` or
289+ There are a special kind of events called "Guard events". Their event listeners
290+ are invoked every time a call to ``Workflow::can ``, ``Workflow::apply `` or
265291``Workflow::getEnabledTransitions `` is executed. With the guard events you may
266- add custom logic to decide what transitions that are valid or not. Here is a list
267- of the guard event names.
292+ add custom logic to decide what transitions that are valid or not. Here is a list
293+ of the guard event names.
268294
269295* ``workflow.guard ``
270296* ``workflow.[workflow name].guard ``
0 commit comments