You are here

public function RegisterRoutersPass::process 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::process()

You can modify the container here before it is dumped to PHP code.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

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

Class

RegisterRoutersPass
Compiler pass to register routers to the ChainRouter.

Namespace

Symfony\Cmf\Component\Routing\DependencyInjection\Compiler

Code

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,
    ));
  }
}