8000 bug #49682 [FrameworkBundle] Workflow - Fix LogicException about a wr… · symfony/symfony@b181772 · GitHub
[go: up one dir, main page]

Skip to content

Commit b181772

Browse files EE45
committed
bug #49682 [FrameworkBundle] Workflow - Fix LogicException about a wrong configuration of "enabled" node (adpauly)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] Workflow - Fix LogicException about a wrong configuration of "enabled" node | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | / | License | MIT | Doc PR | / When I try to configure the YAML node "enabled" under a workflow configuration: ```yaml framework: workflows: order_approval_state: enabled: false # <--- HERE type: state_machine supports: - AppBundle\Entity\OrderApproval ``` The following exception is thrown: ```php //vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php if (isset($workflow['enabled']) && false === $workflow['enabled']) { throw new LogicException(sprintf('Cannot disable a single workflow. Remove the configuration for the workflow "%s" instead.', $workflow['name'])); } ``` But it actually throws the following PHP error: ```bash In Configuration.php line 262: Notice: Undefined index: name ``` I think we should use the **`$key` variable instead of this undefined index.** `$key` contains the workflow name. When changing, I get the attempted exception: ```bash In Configuration.php line 262: Cannot disable a single workflow. Remove the configuration for the workflow "order_approval_state" instead. ``` (I took a look in 6.2, it doesn't fix yet.) Commits ------- 14a4fcf [FrameworkBundle] Workflow - Fix LogicException about a wrong configuration of "enabled" node
2 parents b9348f8 + 14a4fcf commit b181772

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
350350

351351
foreach ($workflows as $key => $workflow) {
352352
if (isset($workflow['enabled']) && false === $workflow['enabled']) {
353-
throw new LogicException(sprintf('Cannot disable a single workflow. Remove the configuration for the workflow "%s" instead.', $workflow['name']));
353+
throw new LogicException(sprintf('Cannot disable a single workflow. Remove the configuration for the workflow "%s" instead.', $key));
354354
}
355355

356356
unset($workflows[$key]['enabled']);

0 commit comments

Comments
 (0)
0