You are here

public function RegisterRouteEnhancersPass::process in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/DependencyInjection/Compiler/RegisterRouteEnhancersPass.php \Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRouteEnhancersPass::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/RegisterRouteEnhancersPass.php, line 40

Class

RegisterRouteEnhancersPass
This compiler pass adds additional route enhancers to the dynamic router.

Namespace

Symfony\Cmf\Component\Routing\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  if (!$container
    ->hasDefinition($this->dynamicRouterService)) {
    return;
  }
  $router = $container
    ->getDefinition($this->dynamicRouterService);
  foreach ($container
    ->findTaggedServiceIds($this->enhancerTag) as $id => $attributes) {
    $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
    $router
      ->addMethodCall('addRouteEnhancer', array(
      new Reference($id),
      $priority,
    ));
  }
}