From 1030f76d02c02e8b2757456095df23ce22cb9b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?= Date: Fri, 24 Mar 2017 11:22:47 +0200 Subject: [PATCH] added bc support for DefinitionDecorator --- DependencyInjection/Compiler/FilterPass.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/Compiler/FilterPass.php b/DependencyInjection/Compiler/FilterPass.php index ef1c2b59..404bf527 100644 --- a/DependencyInjection/Compiler/FilterPass.php +++ b/DependencyInjection/Compiler/FilterPass.php @@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Reference; /** @@ -49,7 +50,11 @@ public function process(ContainerBuilder $container) ); } - $definition = new ChildDefinition($filters[($filterOptions['type'])]); + if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) { + $definition = new ChildDefinition($filters[($filterOptions['type'])]); + } else { + $definition = new DefinitionDecorator($filters[($filterOptions['type'])]); + } $definition->addMethodCall('setRequestField', [$filterOptions['request_field']]); $definition->addMethodCall('setDocumentField', [$filterOptions['document_field']]); $definition->addMethodCall('setTags', [$filterOptions['tags']]);