@@ -148,7 +148,7 @@ like this:
148
148
The marking store type could be "multiple_state" or "single_state".
149
149
A single state marking store does not support a model being on multiple places
150
150
at the same time.
151
-
151
+
152
152
.. tip ::
153
153
154
154
The ``type `` (default value ``single_state ``) and ``arguments `` (default value ``marking ``)
@@ -189,35 +189,53 @@ Each step has three events that are fired in order:
189
189
* An event for the workflow concerned;
190
190
* An event for the workflow concerned with the specific transition or place name.
191
191
192
- The following events are dispatched :
192
+ When a state transition is initiated, the events are fired in the following order :
193
193
194
- * ``workflow.guard ``
195
- * ``workflow.[workflow name].guard ``
196
- * ``workflow.[workflow name].guard.[transition name] ``
194
+ ``workflow.guard ``
195
+ Validate whether the transition is allowed at all (:ref: `see below <workflow-usage-guard-events >`).
197
196
198
- * ``workflow.leave ``
199
- * ``workflow.[workflow name].leave ``
200
- * ``workflow.[workflow name].leave.[place name] ``
197
+ The three events being fired are:
201
198
202
- * ``workflow.transition ``
203
- * ``workflow.[workflow name].transition ``
204
- * ``workflow.[workflow name].transition .[transition name] ``
199
+ * ``workflow.guard ``
200
+ * ``workflow.[workflow name].guard ``
201
+ * ``workflow.[workflow name].guard .[transition name] ``
205
202
206
- * ``workflow.enter ``
207
- * ``workflow.[workflow name].enter ``
208
- * ``workflow.[workflow name].enter.[place name] ``
203
+ ``workflow.leave ``
204
+ The object is about to leave a place.
209
205
210
- * ``workflow.announce ``
211
- * ``workflow.[workflow name].announce ``
212
- * ``workflow.[workflow name].announce.[transition name] ``
206
+ The three events being fired are:
213
207
214
- When a state transition is initiated, the events are fired in the following order:
208
+ * ``workflow.leave ``
209
+ * ``workflow.[workflow name].leave ``
210
+ * ``workflow.[workflow name].leave.[place name] ``
211
+
212
+ ``workflow.transition ``
213
+ The object is going through this transition.
214
+
215
+ The three events being fired are:
216
+
217
+ * ``workflow.transition ``
218
+ * ``workflow.[workflow name].transition ``
219
+ * ``workflow.[workflow name].transition.[transition name] ``
215
220
216
- - guard: Validate whether the transition is allowed at all (:ref: `see below <workflow-usage-guard-events >`);
217
- - leave: The object is about to leave a place;
218
- - transition: The object is going through this transition;
219
- - enter: The object entered a new place. This is the first event where the object' is marked as being in the new place;
220
- - announce: Triggered once for each workflow that now is available for the object.
221
+ ``workflow.enter ``
222
+ The object entered a new place. This is the first event where the object
223
+ is marked as being in the new place.
224
+
225
+ The three events being fired are:
226
+
227
+ * ``workflow.enter ``
228
+ * ``workflow.[workflow name].enter ``
229
+ * ``workflow.[workflow name].enter.[place name] ``
230
+
231
+ ``workflow.announce ``
232
+ Triggered once for each workflow that now is available for the object.
233
+
234
+ The three events being fired are:
235
+
236
+ * ``workflow.announce ``
237
+ * ``workflow.[workflow name].announce ``
238
+ * ``workflow.[workflow name].announce.[transition name] ``
221
239
222
240
Here is an example how to enable logging for every time a the "blog_publishing" workflow leaves a place::
223
241
@@ -231,7 +249,7 @@ Here is an example how to enable logging for every time a the "blog_publishing"
231
249
{
232
250
$this->logger = $logger;
233
251
}
234
-
252
+
235
253
public function onLeave(Event $event)
236
254
{
237
255
$this->logger->alert(sprintf(
@@ -242,7 +260,7 @@ Here is an example how to enable logging for every time a the "blog_publishing"
242
260
implode(', ', $event->getTransition()->getTos())
243
261
));
244
262
}
245
-
263
+
246
264
public static function getSubscribedEvents()
247
265
{
248
266
return array(
@@ -253,14 +271,14 @@ Here is an example how to enable logging for every time a the "blog_publishing"
253
271
254
272
.. _workflow-usage-guard-events :
255
273
256
- Guard events
274
+ Guard Events
257
275
~~~~~~~~~~~~
258
276
259
- There are a special kind of events called "Guard events". Their event listeners
260
- are invoked every time a call to ``Workflow::can ``, ``Workflow::apply `` or
277
+ There are a special kind of events called "Guard events". Their event listeners
278
+ are invoked every time a call to ``Workflow::can ``, ``Workflow::apply `` or
261
279
``Workflow::getEnabledTransitions `` is executed. With the guard events you may
262
- add custom logic to decide what transitions that are valid or not. Here is a list
263
- of the guard event names.
280
+ add custom logic to decide what transitions that are valid or not. Here is a list
281
+ of the guard event names.
264
282
265
283
* ``workflow.guard ``
266
284
* ``workflow.[workflow name].guard ``
0 commit comments