Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c12727d

Browse files
committed
minor #22038 [FrameworkBundle] harden the config when using workflow guards (xabbuh)
This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] harden the config when using workflow guards | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This will forbid using the FrameworkBundle in 3.3 with previous releases of the Workflow to avoid issues related to the GuardListener class not being present. Additionally, it provides a useful exception in case the guard option is used without the ExpressionLanguage component being installed. Commits ------- 418dcc3 harden the config when using workflow guards
2 parents 3ae36f4 + 418dcc3 commit c12727d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Symfony\Component\DependencyInjection\Exception\LogicException;
2626
use Symfony\Component\DependencyInjection\Reference;
2727
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
28+
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
2829
use Symfony\Component\Finder\Finder;
2930
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
3031
use Symfony\Component\Config\FileLocator;
@@ -508,6 +509,11 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
508509
if (!isset($config['guard'])) {
509510
continue;
510511
}
512+
513+
if (!class_exists(ExpressionLanguage::class)) {
514+
throw new LogicException('Cannot guard workflows as the ExpressionLanguage component is not installed.');
515+
}
516+
511517
$eventName = sprintf('workflow.%s.guard.%s', $name, $transitionName);
512518
$guard->addTag('kernel.event_listener', array('event' => $eventName, 'method' => 'onTransition'));
513519
$configuration[$eventName] = $config['guard'];

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"symfony/property-info": "<3.3",
6868
"symfony/serializer": "<3.3",
6969
"symfony/translations": "<3.2",
70-
"symfony/validator": "<3.3"
70+
"symfony/validator": "<3.3",
71+
"symfony/workflow": "<3.3"
7172
},
7273
"suggest": {
7374
"ext-apcu": "For best performance of the system caches",

0 commit comments

Comments
 (0)