Skip to content

Commit bc14095

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [SecurityBundle] Fix compat with symfony/security-core:^6 [DependencyInjection] Fix support for unions/intersections together with `ServiceSubscriberInterface` fixed leftover deprecations PHP 8.1 [Runtime] fix defining APP_DEBUG when Dotenv is not enabled revert using functions provided by polyfill packages [FrameworkBundle] Fix logic in workflow:dump between workflow name and workflow id Bump Symfony version to 5.4.0 Update VERSION for 5.4.0-BETA1 Update CHANGELOG for 5.4.0-BETA1 Add getters and setters for attributes property
2 parents 63aa0c5 + 8194642 commit bc14095

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

Command/WorkflowDumpCommand.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\Console\Input\InputInterface;
2121
use Symfony\Component\Console\Input\InputOption;
2222
use Symfony\Component\Console\Output\OutputInterface;
23+
use Symfony\Component\Workflow\Definition;
2324
use Symfony\Component\Workflow\Dumper\GraphvizDumper;
2425
use Symfony\Component\Workflow\Dumper\MermaidDumper;
2526
use Symfony\Component\Workflow\Dumper\PlantUmlDumper;
@@ -34,6 +35,10 @@
3435
#[AsCommand(name: 'workflow:dump', description: 'Dump a workflow')]
3536
class WorkflowDumpCommand extends Command
3637
{
38+
/**
39+
* string is the service id
40+
* @var array<string, Definition>
41+
*/
3742
private array $workflows = [];
3843

3944
private const DUMP_FORMAT_OPTIONS = [
@@ -78,13 +83,21 @@ protected function configure()
7883
*/
7984
protected function execute(InputInterface $input, OutputInterface $output): int
8085
{
81-
$workflowId = $input->getArgument('name');
86+
$workflowName = $input->getArgument('name');
87+
88+
$workflow = null;
8289

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

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

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

111-
$workflow = $this->workflows[$workflowId];
112-
113124
$options = [
114-
'name' => $workflowId,
125+
'name' => $workflowName,
115126
'nofooter' => true,
116127
'graph' => [
117128
'label' => $input->getOption('label'),

0 commit comments

Comments
 (0)