List available workflows in Symfony
I am using symfony workflow component in a symfony 3 project. I would like to list all available workflows.
Is there a way to find that list? I was looking in the component code base but didn't find anything I could start working on.
Just make a debug with search term.
debug:container --show-private workflow
this would be the result:
Select one of the following services to display its information: [0] console.command.workflow_dump [1] workflow.abstract [2] workflow.marking_store.multiple_state [3] workflow.marking_store.single_state [4] workflow.registry [5] workflow.security.expression_language [6] workflow.blog_publishing [7] workflow.blog_publishing.definition [8] workflow.twig_extension [9] Symfony\Component\Workflow\Registry
The above is a simple and a not usable result for your bussiness logic.
If your intention is to do “something” with the output, take a look at the Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand
and try to extend the command and implement your own logic.
If you extend(which I recommend) the Command you will have access to the getContainerBuilder
function which gets you the builder container and then you can do $builder→getServiceIds()
and start a string search inside a loop returning all the matched services and that would be your workflow list.
Hope it helps!