Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
Fix Symfony 3.3 pre-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jan 21, 2017
1 parent 924d116 commit 8bc362b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/DependencyInjection/CmfSeoExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -250,8 +251,15 @@ private function createRequestMatcher(ContainerBuilder $container, $path = null,
$id = 'cmf_seo.error.request_matcher.'.md5($serialized).sha1($serialized);

if (!$container->hasDefinition($id)) {
if (class_exists(ChildDefinition::class)) {
$definition = new ChildDefinition('cmf_seo.error.request_matcher');
} else {
// BC with Symfony <3.3
$definition = new DefinitionDecorator('cmf_seo.error.request_matcher');
}

$container
->setDefinition($id, new DefinitionDecorator('cmf_seo.error.request_matcher'))
->setDefinition($id, $definition)
->setArguments($arguments)
;
}
Expand Down

0 comments on commit 8bc362b

Please sign in to comment.