vendor/friendsofsymfony/rest-bundle/FOSRestBundle.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the FOSRestBundle package.
  4.  *
  5.  * (c) FriendsOfSymfony <http://friendsofsymfony.github.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 FOS\RestBundle;
  11. use FOS\RestBundle\DependencyInjection\Compiler\ConfigurationCheckPass;
  12. use FOS\RestBundle\DependencyInjection\Compiler\HandlerRegistryDecorationPass;
  13. use FOS\RestBundle\DependencyInjection\Compiler\JMSFormErrorHandlerPass;
  14. use FOS\RestBundle\DependencyInjection\Compiler\JMSHandlersPass;
  15. use FOS\RestBundle\DependencyInjection\Compiler\FormatListenerRulesPass;
  16. use FOS\RestBundle\DependencyInjection\Compiler\SerializerConfigurationPass;
  17. use FOS\RestBundle\DependencyInjection\Compiler\TwigExceptionPass;
  18. use Symfony\Component\DependencyInjection\ContainerBuilder;
  19. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  20. use Symfony\Component\HttpKernel\Bundle\Bundle;
  21. /**
  22.  * @author Lukas Kahwe Smith <smith@pooteeweet.org>
  23.  * @author Eriksen Costa <eriksencosta@gmail.com>
  24.  */
  25. class FOSRestBundle extends Bundle
  26. {
  27.     const ZONE_ATTRIBUTE '_fos_rest_zone';
  28.     /**
  29.      * {@inheritdoc}
  30.      */
  31.     public function build(ContainerBuilder $container)
  32.     {
  33.         $container->addCompilerPass(new SerializerConfigurationPass());
  34.         $container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10);
  35.         $container->addCompilerPass(new FormatListenerRulesPass());
  36.         // must run after \Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass which removes the templating.engine.twig service when templating is not enabled
  37.         $container->addCompilerPass(new TwigExceptionPass(), PassConfig::TYPE_BEFORE_REMOVING, -10);
  38.         $container->addCompilerPass(new JMSFormErrorHandlerPass());
  39.         $container->addCompilerPass(new JMSHandlersPass(), PassConfig::TYPE_BEFORE_REMOVING, -10);
  40.         $container->addCompilerPass(new HandlerRegistryDecorationPass(), PassConfig::TYPE_AFTER_REMOVING);
  41.     }
  42. }