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.1 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 2 different dumpers both based on Dot.

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
// dump-graph-dot.php
$dumper = new GraphvizDumper();
echo $dumper->dump($definition);
1
2
3
// dump-graph-puml.php
$dumper = new PlantUmlDumper();
echo $dumper->dump($definition);
1
2
3
4
5
$ php dump-graph-dot.php | dot -Tpng -o dot_graph.png
$ php dump-graph-puml.php | java -jar plantuml.jar -p  > puml_graph.png

# run this command if you prefer SVG images:
# $ php dump-graph-dot.php | dot -Tsvg -o dot_graph.svg

The DOT result will look like this:

../_images/blogpost.png

The PUML result:

../_images/blogpost_puml.png

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

1
2
$ php bin/console workflow:dump name | dot -Tsvg -o graph.svg
$ php bin/console workflow:dump name --dump-format=puml | java -jar plantuml.jar -p  > workflow.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.