You are browsing the Symfony 4 documentation, which changes significantly from Symfony 3.x. If your app doesn't use Symfony 4 yet, browse the Symfony 3.4 documentation.

How to Dump Workflows

4.2 version
Maintained Unmaintained

How to Dump Workflows

To help you debug your workflows, you can dump a representation of your workflow or state machine with the use of a DumperInterface. Symfony provides two different dumpers, both based on Dot (see below).

Use the GraphvizDumper or StateMachineGraphvizDumper to create DOT files, or use PlantUmlDumper for PlantUML files. Both types can be converted to PNG or SVG images.

Images of the workflow defined above:

1
2
3
4
5
6
7
// dump-graph-dot.php
$dumper = new GraphvizDumper();
echo $dumper->dump($definition);

// dump-graph-puml.php
$dumper = new PlantUmlDumper();
echo $dumper->dump($definition);
1
2
3
4
5
6
7
8
# dump DOT file in PNG image:
$ php dump-graph-dot.php | dot -Tpng -o dot_graph.png

# dump DOT file in SVG image:
# $ php dump-graph-dot.php | dot -Tsvg -o dot_graph.svg

# dump PlantUML in PNG image:
$ php dump-graph-puml.php | java -jar plantuml.jar -p  > puml_graph.png

The DOT result will look like this:

../_images/blogpost.png

The PlantUML result:

../_images/blogpost_puml.png

Inside a Symfony application, you can dump the files with those commands using workflow:dump command:

1
2
3
$ php bin/console workflow:dump workflow_name | dot -Tpng -o workflow_name.png
$ php bin/console workflow:dump workflow_name | dot -Tsvg -o workflow_name.svg
$ php bin/console workflow:dump workflow_name --dump-format=puml | java -jar plantuml.jar -p  > workflow_name.png

Note

The dot command is part of Graphviz. You can download it and read more about it on Graphviz.org.

The plantuml.jar command is part of PlantUML. You can download it and read more about it on PlantUML.com.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.