Skip to content

Commit

Permalink
Merge pull request #238 from saimaz/child-definition-patch
Browse files Browse the repository at this point in the history
Added bc support for DefinitionDecorator
  • Loading branch information
saimaz authored Mar 24, 2017
2 parents d891ead + 1030f76 commit 2f7d635
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DependencyInjection/Compiler/FilterPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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']]);
Expand Down

0 comments on commit 2f7d635

Please sign in to comment.