@@ -5,31 +5,56 @@ How to Dump Workflows
5
5
=====================
6
6
7
7
To help you debug your workflows, you can dump a representation of your workflow
8
- with the use of a ``DumperInterface ``. Use the `` GraphvizDumper `` to create a
9
- PNG image of the workflow defined above::
8
+ or state machine with the use of a ``DumperInterface ``. Symfony provides 2
9
+ different dumpers both based on Dot.
10
10
11
- // dump-graph.php
11
+ Use the ``GraphvizDumper `` or ``StateMachineGraphvizDumper `` to create DOT
12
+ files, or use ``PlantUmlDumper `` for PlantUML files. Both types can be converted
13
+ to PNG images.
14
+
15
+ Images of the workflow defined above:
16
+
17
+ .. code-block :: php
18
+
19
+ // dump-graph-dot.php
12
20
$dumper = new GraphvizDumper();
13
21
echo $dumper->dump($definition);
14
22
23
+ .. code-block :: php
24
+
25
+ // dump-graph-puml.php
26
+ $dumper = new PlantUmlDumper();
27
+ echo $dumper->dump($definition);
28
+
15
29
.. code-block :: terminal
16
30
17
- $ php dump-graph.php | dot -Tpng -o graph.png
31
+ $ php dump-graph-dot.php | dot -Tpng -o dot_graph.png
32
+ $ php dump-graph-puml.php | java -jar plantuml.jar -p > puml_graph.png
18
33
19
- The result will look like this:
34
+ The DOT result will look like this:
20
35
21
36
.. image :: /_images/components/workflow/blogpost.png
22
37
23
- Inside a Symfony application, you can dump the dot file with the
38
+ The PUML result:
39
+
40
+ .. image :: /_images/components/workflow/blogpost_puml.png
41
+
42
+ Inside a Symfony application, you can dump the files with those commands using
24
43
``workflow:dump `` command:
25
44
26
45
.. code-block :: terminal
27
46
28
47
$ php bin/console workflow:dump name | dot -Tpng -o graph.png
48
+ $ php bin/console workflow:dump name --dump-format=puml | java -jar plantuml.jar -p > workflow.png
29
49
30
50
.. note ::
31
51
32
52
The ``dot `` command is part of Graphviz. You can download it and read
33
53
more about it on `Graphviz.org `_.
34
54
55
+ The ``plantuml.jar `` command is part of PlantUML. You can download it and
56
+ read more about it on `PlantUML.com `_.
57
+
58
+
35
59
.. _Graphviz.org : http://www.graphviz.org
60
+ .. _PlantUML.com : http://plantuml.com/
0 commit comments