class AutoAliasServicePass
Sets a service to be an alias of another one, given a format pattern.
Hierarchy
- class \Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface
Expanded class hierarchy of AutoAliasServicePass
File
-
vendor/
symfony/ dependency-injection/ Compiler/ AutoAliasServicePass.php, line 21
Namespace
Symfony\Component\DependencyInjection\CompilerView source
class AutoAliasServicePass implements CompilerPassInterface {
public function process(ContainerBuilder $container) : void {
foreach ($container->findTaggedServiceIds('auto_alias') as $serviceId => $tags) {
foreach ($tags as $tag) {
if (!isset($tag['format'])) {
throw new InvalidArgumentException(\sprintf('Missing tag information "format" on auto_alias service "%s".', $serviceId));
}
$aliasId = $container->getParameterBag()
->resolveValue($tag['format']);
if ($container->hasDefinition($aliasId) || $container->hasAlias($aliasId)) {
$alias = new Alias($aliasId, $container->getDefinition($serviceId)
->isPublic());
$container->setAlias($serviceId, $alias);
}
}
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AutoAliasServicePass::process | public | function | You can modify the container here before it is dumped to PHP code. | Overrides CompilerPassInterface::process |