function ContainerBuilder::doGet
4 calls to ContainerBuilder::doGet()
- ContainerBuilder::callMethod in vendor/
symfony/ dependency-injection/ ContainerBuilder.php - ContainerBuilder::createService in vendor/
symfony/ dependency-injection/ ContainerBuilder.php - Creates a service for a service definition.
- ContainerBuilder::doResolveServices in vendor/
symfony/ dependency-injection/ ContainerBuilder.php - ContainerBuilder::get in vendor/
symfony/ dependency-injection/ ContainerBuilder.php
File
-
vendor/
symfony/ dependency-injection/ ContainerBuilder.php, line 574
Class
- ContainerBuilder
- ContainerBuilder is a DI container that provides an API to easily describe services.
Namespace
Symfony\Component\DependencyInjectionCode
private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, ?array &$inlineServices = null, bool $isConstructorArgument = false) : mixed {
if (isset($inlineServices[$id])) {
return $inlineServices[$id];
}
if (null === $inlineServices) {
$isConstructorArgument = true;
$inlineServices = [];
}
try {
if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) {
return $this->privates[$id] ?? parent::get($id, $invalidBehavior);
}
if (null !== ($service = $this->privates[$id] ?? parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE))) {
return $service;
}
} catch (ServiceCircularReferenceException $e) {
if ($isConstructorArgument) {
throw $e;
}
}
if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) {
$alias = $this->aliasDefinitions[$id];
if ($alias->isDeprecated()) {
$deprecation = $alias->getDeprecation($id);
trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']);
}
return $this->doGet((string) $alias, $invalidBehavior, $inlineServices, $isConstructorArgument);
}
try {
$definition = $this->getDefinition($id);
} catch (ServiceNotFoundException $e) {
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $invalidBehavior) {
return null;
}
throw $e;
}
if ($definition->hasErrors() && ($e = $definition->getErrors())) {
throw new RuntimeException(reset($e));
}
if ($isConstructorArgument) {
$this->loading[$id] = true;
}
try {
return $this->createService($definition, $inlineServices, $isConstructorArgument, $id);
} finally {
if ($isConstructorArgument) {
unset($this->loading[$id]);
}
}
}