[Workflow] Fixed the dump command
* The 'label' option had a wrong mode * Simplified the code
This commit is contained in:
parent
89d1b65037
commit
3d01404da0
@ -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