8000 [FrameworkBundle] Fix logic in workflow:dump between workflow name an… · symfony/symfony@0e9c70f · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e9c70f

Browse files
[FrameworkBundle] Fix logic in workflow:dump between workflow name and workflow id
1 parent d7ea3de commit 0e9c70f

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,27 @@ protected function configure()
7979
*/
8080
protected function execute(InputInterface $input, OutputInterface $output): int
8181
{
82-
$workflowId = $input->getArgument('name');
82+
$workflowName = $input->getArgument('name');
8383

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));
84+
$workflow = null;
85+
86+
$workflowId = 'workflow.' . $workflowName;
87+
if (\in_array($workflowId, array_keys($this->workflows), true)) {
88+
$workflow = $this->workflows[$workflowId];
89+
$type = 'workflow';
8690
}
8791

88-
$type = explode('.', $workflowId)[0];
92+
if (!$workflow) {
93+
$workflowId = 'state_machine.' . $workflowName;
94+
if (\in_array($workflowId, array_keys($this->workflows), true)) {
95+
$workflow = $this->workflows[$workflowId];
96+
$type = 'state_machine';
97+
}
98+
}
99+
100+
if (null === $workflow) {
101+
throw new InvalidArgumentException(sprintf('No service found for "workflow.%1$s" nor "state_machine.%1$s".', $workflowName));
102+
}
89103

90104
switch ($input->getOption('dump-format')) {
91105
case 'puml':
@@ -109,8 +123,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
109123
$marking->mark($place);
110124
}
111125

112-
$workflow = $this->workflows[$workflowId];
113-
114126
$options = [
115127
'name' => $workflowId,
116128
'nofooter' => true,

0 commit comments

Comments
 (0)
0