function ResolveReferencesToAliasesPass::getDefinitionId
2 calls to ResolveReferencesToAliasesPass::getDefinitionId()
- ResolveReferencesToAliasesPass::process in vendor/
symfony/ dependency-injection/ Compiler/ ResolveReferencesToAliasesPass.php - You can modify the container here before it is dumped to PHP code.
- ResolveReferencesToAliasesPass::processValue in vendor/
symfony/ dependency-injection/ Compiler/ ResolveReferencesToAliasesPass.php - Processes a value found in a definition tree.
File
-
vendor/
symfony/ dependency-injection/ Compiler/ ResolveReferencesToAliasesPass.php, line 52
Class
- ResolveReferencesToAliasesPass
- Replaces all references to aliases with references to the actual service.
Namespace
Symfony\Component\DependencyInjection\CompilerCode
private function getDefinitionId(string $id, ContainerBuilder $container) : string {
if (!$container->hasAlias($id)) {
return $id;
}
$alias = $container->getAlias($id);
if ($alias->isDeprecated()) {
$referencingDefinition = $container->hasDefinition($this->currentId) ? $container->getDefinition($this->currentId) : $container->getAlias($this->currentId);
if (!$referencingDefinition->isDeprecated()) {
$deprecation = $alias->getDeprecation($id);
trigger_deprecation($deprecation['package'], $deprecation['version'], rtrim($deprecation['message'], '. ') . '. It is being referenced by the "%s" ' . ($container->hasDefinition($this->currentId) ? 'service.' : 'alias.'), $this->currentId);
}
}
$seen = [];
do {
if (isset($seen[$id])) {
throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), [
$id,
]));
}
$seen[$id] = true;
$id = (string) $container->getAlias($id);
} while ($container->hasAlias($id));
return $id;
}