Skip to content

Commit 1781280

Browse files
committed
[Workflow] Update the article about dumping workflows
1 parent ad66fbc commit 1781280

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

workflow/dumping-workflows.rst

+20-20
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,38 @@
44
How to Dump Workflows
55
=====================
66

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.
1011

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:
1414

1515
.. code-block:: terminal
1616
17-
$ php dump-graph.php | dot -Tsvg -o graph.svg
17+
$ php bin/console workflow:dump workflow-name | dot -Tsvg -o graph.svg
1818
1919
# 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
2124
2225
The result will look like this:
2326

2427
.. image:: /_images/components/workflow/blogpost.png
2528

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::
3031

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);
3535

36-
.. note::
36+
.. code-block:: terminal
3737
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
4040
41-
.. _Graphviz.org: http://www.graphviz.org
41+
.. _`Graphviz project`: http://www.graphviz.org

0 commit comments

Comments
 (0)