diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml
index 76592087a2260..3203870393923 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml
@@ -22,10 +22,5 @@
-
-
-
-
-
diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
index 1491b04ac0545..00d140369d2e3 100644
--- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
+++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
@@ -18,6 +18,7 @@
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\Stopwatch\Stopwatch;
+use Symfony\Component\Workflow\Workflow;
use Symfony\Component\Yaml\Parser as YamlParser;
/**
@@ -115,6 +116,13 @@ public function process(ContainerBuilder $container)
if (class_exists(ExpressionLanguage::class)) {
$container->getDefinition('twig.extension.expression')->addTag('twig.extension');
}
+
+ $container->addResource(new ClassExistenceResource(Workflow::class));
+ if (!class_exists(Workflow::class) || !$container->has('workflow.registry')) {
+ $container->removeDefinition('workflow.twig_extension');
+ } else {
+ $container->getDefinition('workflow.twig_extension')->addTag('twig.extension');
+ }
}
private function getComposerRootDir($rootDir)
diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
index 800fc08367fd8..8eb702c99ee45 100644
--- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
+++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
@@ -106,6 +106,10 @@
+
+
+
+