.. index:: single: Workflow; Dumping 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:
// dump-graph-dot.php
$dumper = new GraphvizDumper();
echo $dumper->dump($definition);
// dump-graph-puml.php
$dumper = new PlantUmlDumper();
echo $dumper->dump($definition);
$ 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:
The PUML result:
Inside a Symfony application, you can dump the files with those commands using
workflow:dump
command:
$ 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.