Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8a9e826

Browse filesBrowse files
committed
bug #43940 [FrameworkBundle] Fix logic in workflow:dump between workflow name and workflow id (noniagriconomie)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] Fix logic in workflow:dump between workflow name and workflow id | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #43938 | License | MIT As described in #43938 (comment) the command need a workflow name as argument, but the array contains workflows ids (prefix `workflow|state_machine`) Commits ------- d043641 [FrameworkBundle] Fix logic in workflow:dump between workflow name and workflow id
2 parents d7ea3de + d043641 commit 8a9e826
Copy full SHA for 8a9e826

File tree

1 file changed

+18
-7
lines changed
Filter options

1 file changed

+18
-7
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php
+18-7Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Console\Input\InputInterface;
2020
use Symfony\Component\Console\Input\InputOption;
2121
use Symfony\Component\Console\Output\OutputInterface;
22+
use Symfony\Component\Workflow\Definition;
2223
use Symfony\Component\Workflow\Dumper\GraphvizDumper;
2324
use Symfony\Component\Workflow\Dumper\MermaidDumper;
2425
use Symfony\Component\Workflow\Dumper\PlantUmlDumper;
@@ -34,6 +35,10 @@ class WorkflowDumpCommand extends Command
3435
{
3536
protected static $defaultName = 'workflow:dump';
3637
protected static $defaultDescription = 'Dump a workflow';
38+
/**
39+
* string is the service id
40+
* @var array<string, Definition>
41+
*/
3742
private $workflows = [];
3843

3944
private const DUMP_FORMAT_OPTIONS = [
@@ -79,13 +84,21 @@ protected function configure()
7984
*/
8085
protected function execute(InputInterface $input, OutputInterface $output): int
8186
{
82-
$workflowId = $input->getArgument('name');
87+
$workflowName = $input->getArgument('name');
88+
89+
$workflow = null;
8390

84-
if (!\in_array($workflowId, array_keys($this->workflows), true)) {
85-
throw new InvalidArgumentException(sprintf('No service found for "workflow.%1$s" nor "state_machine.%1$s".', $workflowId));
91+
if (isset($this->workflows['workflow.'.$workflowName])) {
92+
$workflow = $this->workflows['workflow.'.$workflowName];
93+
$type = 'workflow';
94+
} elseif (isset($this->workflows['state_machine.'.$workflowName])) {
95+
$workflow = $this->workflows['state_machine.'.$workflowName];
96+
$type = 'state_machine';
8697
}
8798

88-
$type = explode('.', $workflowId)[0];
99+
if (null === $workflow) {
100+
throw new InvalidArgumentException(sprintf('No service found for "workflow.%1$s" nor "state_machine.%1$s".', $workflowName));
101+
}
89102

90103
switch ($input->getOption('dump-format')) {
91104
case 'puml':
@@ -109,10 +122,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
109122
$marking->mark($place);
110123
}
111124

112-
$workflow = $this->workflows[$workflowId];
113-
114125
$options = [
115-
'name' => $workflowId,
126+
'name' => $workflowName,
116127
'nofooter' => true,
117128
'graph' => [
118129
'label' => $input->getOption('label'),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.