Skip to content

Commit

Permalink
bug #34715 [TwigBundle] remove service when base class is missing (xa…
Browse files Browse the repository at this point in the history
…bbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[TwigBundle] remove service when base class is missing

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

c3a658a remove service when base class is missing
  • Loading branch information
fabpot committed Nov 30, 2019
2 parents 0a2a176 + c3a658a commit b357488
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;

use Symfony\Bridge\Twig\Extension\AssetExtension;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -119,6 +120,10 @@ public function process(ContainerBuilder $container)
$loader = $container->getDefinition('twig.loader.filesystem');
$loader->setMethodCalls(array_merge($twigLoader->getMethodCalls(), $loader->getMethodCalls()));

if (!method_exists(AssetExtension::class, 'getName')) {
$container->removeDefinition('templating.engine.twig');
}

$twigLoader->clearTag('twig.loader');
} else {
$container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false));
Expand Down

0 comments on commit b357488

Please sign in to comment.