Skip to content

Commit 4081bc6

Browse files
bug symfony#28007 [FrameworkBundle] fixed guard event names for transitions (destillat)
This PR was submitted for the 3.3 branch but it was merged into the 3.4 branch instead (closes symfony#28007). Discussion ---------- [FrameworkBundle] fixed guard event names for transitions | Q | A | ------------- | --- | Branch? | 3.3|4 | Bug fix? | yes | New feature? |no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Framework yaml configuration support workflow transitions as both indexed and associative array e.g ```yaml transitions: - name: test from: open to: test - ``` ```yaml transitions: test: from: open to: test ``` Then it's used in foreach loop to register guard event listeners https://github.com/symfony/symfony/blob/4b92b96796d381b225b6665b15160c4c9b06cf41/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L609 Array keys are used as transition names but it's wrong for indexed array so we get event names like these workflow.workflow_name.guard.transition_index instead of workflow.workflow_name.guard.tranision_name Commits ------- 9bbb1e5 [FrameworkBundle] fixed guard event names for transitions
2 parents f495168 + 9bbb1e5 commit 4081bc6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,9 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
679679
$guard = new Definition(Workflow\EventListener\GuardListener::class);
680680
$guard->setPrivate(true);
681681
$configuration = array();
682-
foreach ($workflow['transitions'] as $transitionName => $config) {
682+
foreach ($workflow['transitions'] as $config) {
683+
$transitionName = $config['name'];
684+
683685
if (!isset($config['guard'])) {
684686
continue;
685687
}

0 commit comments

Comments
 (0)