Skip to content

Commit a1fc65e

Browse files
shdevfabpot
authored andcommitted
Pr/workflow name as graph label
1 parent 8f027b4 commit a1fc65e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Allowed to pass an optional `LoggerInterface $logger` instance to the `Router`
88
* Added a new `parameter_bag` service with related autowiring aliases to access parameters as-a-service
99
* Allowed the `Router` to work with any PSR-11 container
10+
* added option in workflow dump command to label graph with a custom label
1011

1112
4.0.0
1213
-----

Command/WorkflowDumpCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Console\Command\Command;
1515
use Symfony\Component\Console\Input\InputArgument;
1616
use Symfony\Component\Console\Input\InputInterface;
17+
use Symfony\Component\Console\Input\InputOption;
1718
use Symfony\Component\Console\Output\OutputInterface;
1819
use Symfony\Component\Workflow\Dumper\GraphvizDumper;
1920
use Symfony\Component\Workflow\Dumper\StateMachineGraphvizDumper;
@@ -37,6 +38,7 @@ protected function configure()
3738
->setDefinition(array(
3839
new InputArgument('name', InputArgument::REQUIRED, 'A workflow name'),
3940
new InputArgument('marking', InputArgument::IS_ARRAY, 'A marking (a list of places)'),
41+
new InputOption('label', 'l', InputArgument::OPTIONAL, 'Labels a graph'),
4042
))
4143
->setDescription('Dump a workflow')
4244
->setHelp(<<<'EOF'
@@ -73,6 +75,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
7375
$marking->mark($place);
7476
}
7577

76-
$output->writeln($dumper->dump($workflow->getDefinition(), $marking));
78+
$options = array();
79+
$label = $input->getOption('label');
80+
if (null !== $label && '' !== trim($label)) {
81+
$options = array('graph' => array('label' => $label));
82+
}
83+
$output->writeln($dumper->dump($workflow->getDefinition(), $marking, $options));
7784
}
7885
}

0 commit comments

Comments
 (0)