You are here

class RegisterRoutersPass in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony-cmf/routing/DependencyInjection/Compiler/RegisterRoutersPass.php \Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRoutersPass

Compiler pass to register routers to the ChainRouter.

@author Wouter J <waldio.webdesign@gmail.com> @author Henrik Bjornskov <henrik@bjrnskov.dk> @author Magnus Nordlander <magnus@e-butik.se>

Hierarchy

Expanded class hierarchy of RegisterRoutersPass

1 file declares its use of RegisterRoutersPass
RegisterRoutersPassTest.php in vendor/symfony-cmf/routing/Tests/DependencyInjection/Compiler/RegisterRoutersPassTest.php

File

vendor/symfony-cmf/routing/DependencyInjection/Compiler/RegisterRoutersPass.php, line 25

Namespace

Symfony\Cmf\Component\Routing\DependencyInjection\Compiler
View source
class RegisterRoutersPass implements CompilerPassInterface {

  /**
   * @var string
   */
  protected $chainRouterService;
  protected $routerTag;
  public function __construct($chainRouterService = 'cmf_routing.router', $routerTag = 'router') {
    $this->chainRouterService = $chainRouterService;
    $this->routerTag = $routerTag;
  }
  public function process(ContainerBuilder $container) {
    if (!$container
      ->hasDefinition($this->chainRouterService)) {
      return;
    }
    $definition = $container
      ->getDefinition($this->chainRouterService);
    foreach ($container
      ->findTaggedServiceIds($this->routerTag) as $id => $attributes) {
      $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
      $definition
        ->addMethodCall('add', array(
        new Reference($id),
        $priority,
      ));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RegisterRoutersPass::$chainRouterService protected property
RegisterRoutersPass::$routerTag protected property
RegisterRoutersPass::process public function You can modify the container here before it is dumped to PHP code. Overrides CompilerPassInterface::process
RegisterRoutersPass::__construct public function