You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Workflow] Mark registry as internal and deprecate the service
Instead, all workflow services are tagged and can be injected with the
following YAML syntax:
```yaml
!tagged_locator { tag: workflow, index_by: name }
```
or PHP syntax:
```php
tagged_locator('workflow', 'name')
```
Also, two others tags exists for each workflow types
* `workflow.workflow`
* `workflow.state_machine`
@@ -40,19 +42,28 @@ class WorkflowDumpCommand extends Command
40
42
*
41
43
* @var array<string, Definition>
42
44
*/
43
-
privatearray$workflows = [];
45
+
privatearray$definitions = [];
46
+
47
+
privateServiceLocator$workflows;
44
48
45
49
privateconstDUMP_FORMAT_OPTIONS = [
46
50
'puml',
47
51
'mermaid',
48
52
'dot',
49
53
];
50
54
51
-
publicfunction__construct(array$workflows)
55
+
publicfunction__construct($workflows)
52
56
{
53
57
parent::__construct();
54
58
55
-
$this->workflows = $workflows;
59
+
if ($workflowsinstanceof ServiceLocator) {
60
+
$this->workflows = $workflows;
61
+
} elseif (\is_array($workflows)) {
62
+
$this->definitions = $workflows;
63
+
trigger_deprecation('symfony/framework-bundle', '6.2', 'Passing an array of definitions in "%s()" is deprecated. Inject a ServiceLocator filled with all workflows instead.', __METHOD__);
64
+
} else {
65
+
thrownew \TypeError(sprintf('Argument 1 passed to "%s()" must be an array or a ServiceLocator, "%s" given.', __METHOD__, \gettype($workflows)));
66
+
}
56
67
}
57
68
58
69
/**
@@ -88,15 +99,22 @@ protected function execute(InputInterface $input, OutputInterface $output): int
88
99
89
100
$workflow = null;
90
101
91
-
if (isset($this->workflows['workflow.'.$workflowName])) {
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated since Symfony 6.2 and will be removed in Symfony 7.0. Inject the workflow directly.')
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" service is deprecated since Symfony 6.2 and will be removed in Symfony 7.0. Inject the workflow directly.')
0 commit comments