Skip to content

[Workflow] PlantUML Dump documentation #9220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added _images/components/workflow/blogpost_puml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 31 additions & 6 deletions workflow/dumping-workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,56 @@ How to Dump Workflows
=====================

To help you debug your workflows, you can dump a representation of your workflow
with the use of a ``DumperInterface``. Use the ``GraphvizDumper`` to create a
PNG image of the workflow defined above::
or state machine with the use of a ``DumperInterface``. Symfony provides 2
different dumpers both based on Dot.

// dump-graph.php
Use the ``GraphvizDumper`` or ``StateMachineGraphvizDumper`` to create DOT
files, or use ``PlantUmlDumper`` for PlantUML files. Both types can be converted
to PNG images.

Images of the workflow defined above:

.. code-block:: php

// dump-graph-dot.php
$dumper = new GraphvizDumper();
echo $dumper->dump($definition);

.. code-block:: php

// dump-graph-puml.php
$dumper = new PlantUmlDumper();
echo $dumper->dump($definition);

.. code-block:: terminal

$ php dump-graph.php | dot -Tpng -o graph.png
$ php dump-graph-dot.php | dot -Tpng -o dot_graph.png
$ php dump-graph-puml.php | java -jar plantuml.jar -p > puml_graph.png

The result will look like this:
The DOT result will look like this:

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

Inside a Symfony application, you can dump the dot file with the
The PUML result:

.. image:: /_images/components/workflow/blogpost_puml.png

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

.. code-block:: terminal

$ php bin/console workflow:dump name | dot -Tpng -o graph.png
$ 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`_.


.. _Graphviz.org: http://www.graphviz.org
.. _PlantUML.com: http://plantuml.com/