You are here

public function ContainerBuilder::loadFromExtension in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::loadFromExtension()

Loads the configuration for an extension.

@api

Parameters

string $extension The extension alias or namespace:

array $values An array of values that customizes the extension:

Return value

ContainerBuilder The current instance

Throws

BadMethodCallException When this ContainerBuilder is frozen

\LogicException if the container is frozen

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 295

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function loadFromExtension($extension, array $values = array()) {
  if ($this
    ->isFrozen()) {
    throw new BadMethodCallException('Cannot load from an extension on a frozen container.');
  }
  $namespace = $this
    ->getExtension($extension)
    ->getAlias();
  $this->extensionConfigs[$namespace][] = $values;
  return $this;
}