TwigBundle.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\TwigBundle;
  11. use Symfony\Component\HttpKernel\Bundle\Bundle;
  12. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
  15. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
  16. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExceptionListenerPass;
  17. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass;
  18. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass;
  19. /**
  20. * Bundle.
  21. *
  22. * @author Fabien Potencier <fabien@symfony.com>
  23. */
  24. class TwigBundle extends Bundle
  25. {
  26. public function build(ContainerBuilder $container)
  27. {
  28. parent::build($container);
  29. $container->addCompilerPass(new ExtensionPass());
  30. $container->addCompilerPass(new TwigEnvironmentPass());
  31. $container->addCompilerPass(new TwigLoaderPass());
  32. $container->addCompilerPass(new ExceptionListenerPass());
  33. $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING);
  34. }
  35. }