Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.78 KB

dumping-workflows.rst

File metadata and controls

63 lines (40 loc) · 1.78 KB
.. index::
    single: Workflow; Dumping Workflows

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:

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

/_images/components/workflow/blogpost.png

The PUML result:

/_images/components/workflow/blogpost_puml.png

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.