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

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 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 VIEW_ATTRIBUTE = '_fos_rest_view';
  27. const ZONE_ATTRIBUTE = '_fos_rest_zone';
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function build(ContainerBuilder $container): void
  32. {
  33. $container->addCompilerPass(new SerializerConfigurationPass());
  34. $container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10);
  35. $container->addCompilerPass(new FormatListenerRulesPass());
  36. $container->addCompilerPass(new JMSFormErrorHandlerPass());
  37. $container->addCompilerPass(new JMSHandlersPass(), PassConfig::TYPE_BEFORE_REMOVING, -10);
  38. $container->addCompilerPass(new HandlerRegistryDecorationPass(), PassConfig::TYPE_AFTER_REMOVING);
  39. }
  40. }