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

  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 Symfony\Component\DependencyInjection\ContainerBuilder;
  18. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  19. use Symfony\Component\HttpKernel\Bundle\Bundle;
  20. /**
  21.  * @author Lukas Kahwe Smith <smith@pooteeweet.org>
  22.  * @author Eriksen Costa <eriksencosta@gmail.com>
  23.  */
  24. class FOSRestBundle extends Bundle
  25. {
  26.     const ZONE_ATTRIBUTE '_fos_rest_zone';
  27.     /**
  28.      * {@inheritdoc}
  29.      */
  30.     public function build(ContainerBuilder $container)
  31.     {
  32.         $container->addCompilerPass(new SerializerConfigurationPass());
  33.         $container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10);
  34.         $container->addCompilerPass(new FormatListenerRulesPass());
  35.         $container->addCompilerPass(new JMSFormErrorHandlerPass());
  36.         $container->addCompilerPass(new JMSHandlersPass(), PassConfig::TYPE_BEFORE_REMOVING, -10);
  37.         $container->addCompilerPass(new HandlerRegistryDecorationPass(), PassConfig::TYPE_AFTER_REMOVING);
  38.     }
  39. }