bug #26072 [Workflow] Fixed the dump command (lyrixx)
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Workflow] Fixed the dump command
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets |
| License | MIT
| Doc PR |
---
* The 'label' option had a wrong mode
* Simplified the code
Commits
-------
3d01404
[Workflow] Fixed the dump command
This commit is contained in:
commit
ad13f07988
@ -39,7 +39,7 @@ class WorkflowDumpCommand extends Command
|
|||||||
->setDefinition(array(
|
->setDefinition(array(
|
||||||
new InputArgument('name', InputArgument::REQUIRED, 'A workflow name'),
|
new InputArgument('name', InputArgument::REQUIRED, 'A workflow name'),
|
||||||
new InputArgument('marking', InputArgument::IS_ARRAY, 'A marking (a list of places)'),
|
new InputArgument('marking', InputArgument::IS_ARRAY, 'A marking (a list of places)'),
|
||||||
new InputOption('label', 'l', InputArgument::OPTIONAL, 'Labels a graph'),
|
new InputOption('label', 'l', InputOption::VALUE_REQUIRED, 'Labels a graph'),
|
||||||
new InputOption('dump-format', null, InputOption::VALUE_REQUIRED, 'The dump format [dot|puml]', 'dot'),
|
new InputOption('dump-format', null, InputOption::VALUE_REQUIRED, 'The dump format [dot|puml]', 'dot'),
|
||||||
))
|
))
|
||||||
->setDescription('Dump a workflow')
|
->setDescription('Dump a workflow')
|
||||||
@ -47,7 +47,7 @@ class WorkflowDumpCommand extends Command
|
|||||||
The <info>%command.name%</info> command dumps the graphical representation of a
|
The <info>%command.name%</info> command dumps the graphical representation of a
|
||||||
workflow in different formats
|
workflow in different formats
|
||||||
|
|
||||||
<info>DOT</info>: %command.full_name% <workflow name> | dot -Tpng > workflow.png
|
<info>DOT</info>: %command.full_name% <workflow name> | dot -Tpng > workflow.png
|
||||||
<info>PUML</info>: %command.full_name% <workflow name> --dump-format=puml | java -jar plantuml.jar -p > workflow.png
|
<info>PUML</info>: %command.full_name% <workflow name> --dump-format=puml | java -jar plantuml.jar -p > workflow.png
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@ -74,9 +74,8 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('puml' === $input->getOption('dump-format')) {
|
if ('puml' === $input->getOption('dump-format')) {
|
||||||
$dumper = new PlantUmlDumper(
|
$transitionType = 'workflow' === $type ? PlantUmlDumper::WORKFLOW_TRANSITION : PlantUmlDumper::STATEMACHINE_TRANSITION;
|
||||||
'workflow' === $type ? PlantUmlDumper::WORKFLOW_TRANSITION : PlantUmlDumper::STATEMACHINE_TRANSITION
|
$dumper = new PlantUmlDumper($transitionType);
|
||||||
);
|
|
||||||
} elseif ('workflow' === $type) {
|
} elseif ('workflow' === $type) {
|
||||||
$dumper = new GraphvizDumper();
|
$dumper = new GraphvizDumper();
|
||||||
} else {
|
} else {
|
||||||
@ -89,12 +88,13 @@ EOF
|
|||||||
$marking->mark($place);
|
$marking->mark($place);
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array();
|
$options = array(
|
||||||
$label = $input->getOption('label');
|
'name' => $serviceId,
|
||||||
if (null !== $label && '' !== trim($label)) {
|
'nofooter' => true,
|
||||||
$options = array('graph' => array('label' => $label));
|
'graph' => array(
|
||||||
}
|
'label' => $input->getOption('label'),
|
||||||
$options = array_replace($options, array('name' => $serviceId, 'nofooter' => true));
|
),
|
||||||
|
);
|
||||||
$output->writeln($dumper->dump($workflow->getDefinition(), $marking, $options));
|
$output->writeln($dumper->dump($workflow->getDefinition(), $marking, $options));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user