function ContainerBuilder::loadFromExtension
Loads the configuration for an extension.
Parameters
string $extension The extension alias or namespace:
array<string, mixed>|null $values An array of values that customizes the extension:
Return value
$this
Throws
BadMethodCallException When this ContainerBuilder is compiled
\LogicException if the extension is not registered
File
-
vendor/
symfony/ dependency-injection/ ContainerBuilder.php, line 476
Class
- ContainerBuilder
- ContainerBuilder is a DI container that provides an API to easily describe services.
Namespace
Symfony\Component\DependencyInjectionCode
public function loadFromExtension(string $extension, ?array $values = null) : static {
if ($this->isCompiled()) {
throw new BadMethodCallException('Cannot load from an extension on a compiled container.');
}
$namespace = $this->getExtension($extension)
->getAlias();
$this->extensionConfigs[$namespace][] = $values ?? [];
return $this;
}