|
4 | 4 | How to Dump Workflows
|
5 | 5 | =====================
|
6 | 6 |
|
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 or SVG image of the workflow defined above:: |
| 7 | +To help you debug your workflows, you can generate a visual representation of |
| 8 | +them as SVG or PNG images. First, download and install the `Graphviz project`_, |
| 9 | +an open source graph visualization software which provides the ``dot`` command |
| 10 | +needed to generate the images. |
10 | 11 |
|
11 |
| - // dump-graph.php |
12 |
| - $dumper = new GraphvizDumper(); |
13 |
| - echo $dumper->dump($definition); |
| 12 | +If you are defining the workflow inside a Symfony application, run this command |
| 13 | +to dump it as an image: |
14 | 14 |
|
15 | 15 | .. code-block:: terminal
|
16 | 16 |
|
17 |
| - $ php dump-graph.php | dot -Tsvg -o graph.svg |
| 17 | + $ php bin/console workflow:dump workflow-name | dot -Tsvg -o graph.svg |
18 | 18 |
|
19 | 19 | # run this command if you prefer PNG images:
|
20 |
| - # $ php dump-graph.php | dot -Tpng -o graph.png |
| 20 | + $ php bin/console workflow:dump workflow-name | dot -Tpng -o graph.png |
| 21 | +
|
| 22 | + # highlight 'place1' and 'place2' in the dumped workflow |
| 23 | + $ php bin/console workflow:dump workflow-name place1 place2 | dot -Tsvg -o graph.svg |
21 | 24 |
|
22 | 25 | The result will look like this:
|
23 | 26 |
|
24 | 27 | .. image:: /_images/components/workflow/blogpost.png
|
25 | 28 |
|
26 |
| -If you have configured your workflow with the Symfony framework, you may dump the dot file |
27 |
| -with the ``WorkflowDumpCommand``: |
28 |
| - |
29 |
| -.. code-block:: terminal |
| 29 | +If you are creating workflows outside of a Symfony application, use the |
| 30 | +``GraphvizDumper`` class to dump the workflow representation:: |
30 | 31 |
|
31 |
| - $ php bin/console workflow:dump name | dot -Tsvg -o graph.svg |
32 |
| -
|
33 |
| - # highlight 'place1' and 'place2' in the dumped workflow |
34 |
| - $ php bin/console workflow:dump name place1 place2 | dot -Tsvg -o graph.svg |
| 32 | + // Add this code to a PHP script; for example: dump-graph.php |
| 33 | + $dumper = new GraphvizDumper(); |
| 34 | + echo $dumper->dump($definition); |
35 | 35 |
|
36 |
| -.. note:: |
| 36 | +.. code-block:: terminal |
37 | 37 |
|
38 |
| - The ``dot`` command is part of Graphviz. You can download it and read |
39 |
| - more about it on `Graphviz.org`_. |
| 38 | + # replace 'dump-graph.php' by the name of your PHP script |
| 39 | + $ php dump-graph.php | dot -Tsvg -o graph.svg |
40 | 40 |
|
41 |
| -.. _Graphviz.org: http://www.graphviz.org |
| 41 | +.. _`Graphviz project`: http://www.graphviz.org |
0 commit comments