Registers route enhancer services with the router.
Expanded class hierarchy of RegisterRouteEnhancersPass
class RegisterRouteEnhancersPass implements CompilerPassInterface {
/**
* Adds services tagged with "route_enhancer" to the router.
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
* The container to process.
*/
public function process(ContainerBuilder $container) {
if (!$container
->hasDefinition('router.dynamic')) {
return;
}
$router = $container
->getDefinition('router.dynamic');
foreach ($container
->findTaggedServiceIds('route_enhancer') as $id => $attributes) {
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
$router
->addMethodCall('addRouteEnhancer', array(
new Reference($id),
$priority,
));
}
$legacy_router = $container
->getDefinition('legacy_router');
foreach ($container
->findTaggedServiceIds('legacy_route_enhancer') as $id => $attributes) {
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
$legacy_router
->addMethodCall('addRouteEnhancer', array(
new Reference($id),
$priority,
));
}
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RegisterRouteEnhancersPass:: |
public | function |
Adds services tagged with "route_enhancer" to the router. Overrides CompilerPassInterface:: |