RoutingResolverPass.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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\FrameworkBundle\DependencyInjection\Compiler;
  11. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. use Symfony\Component\DependencyInjection\Reference;
  14. /**
  15. * Adds tagged routing.loader services to routing.resolver service.
  16. *
  17. * @author Fabien Potencier <fabien@symfony.com>
  18. */
  19. class RoutingResolverPass implements CompilerPassInterface
  20. {
  21. public function process(ContainerBuilder $container)
  22. {
  23. if (false === $container->hasDefinition('routing.resolver')) {
  24. return;
  25. }
  26. $definition = $container->getDefinition('routing.resolver');
  27. foreach ($container->findTaggedServiceIds('routing.loader') as $id => $attributes) {
  28. $definition->addMethodCall('addLoader', array(new Reference($id)));
  29. }
  30. }
  31. }