class ContainerBuilder

Same name in this branch

Drupal's dependency injection container builder.

@todo Submit upstream patches to Symfony to not require these overrides.

Hierarchy

Expanded class hierarchy of ContainerBuilder

12 files declare their use of ContainerBuilder
bootstrap.inc in drupal/core/includes/bootstrap.inc
Functions that need to be loaded on every Drupal request.
DrupalKernel.php in drupal/core/lib/Drupal/Core/DrupalKernel.php
Definition of Drupal\Core\DrupalKernel.
DrupalUnitTestBase.php in drupal/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php
Contains Drupal\simpletest\DrupalUnitTestBase.
HttpKernelTest.php in drupal/core/tests/Drupal/Tests/Core/HttpKernelTest.php
Contains \Drupal\Tests\Core\HttpKernelTest.
LanguageDependencyInjectionTest.php in drupal/core/modules/language/lib/Drupal/language/Tests/LanguageDependencyInjectionTest.php
Definition of Drupal\language\Tests\LanguageDependencyInjectionTest.

... See full list

File

drupal/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php, line 18
Definition of Drupal\Core\DependencyInjection\Container.

Namespace

Drupal\Core\DependencyInjection
View source
class ContainerBuilder extends BaseContainerBuilder {

  /**
   * Overrides Symfony\Component\DependencyInjection\ContainerBuilder::addObjectResource().
   *
   * Drupal does not use Symfony's Config component, so we override
   * addObjectResource() with an empty implementation to prevent errors during
   * container compilation.
   */
  public function addObjectResource($object) {
  }

  /**
   * Overrides Symfony\Component\DependencyInjection\ContainerBuilder::set().
   *
   * Drupal's container builder can be used at runtime after compilation, so we
   * override Symfony's ContainerBuilder's restriction on setting services in a
   * frozen builder.
   *
   * @todo Restrict this to synthetic services only. Ideally, the upstream
   *   ContainerBuilder class should be fixed to allow setting synthetic
   *   services in a frozen builder.
   */
  public function set($id, $service, $scope = self::SCOPE_CONTAINER) {
    Container::set($id, $service, $scope);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Container::$aliases protected property
Container::$loading protected property
Container::$methodMap protected property
Container::$parameterBag protected property
Container::$scopeChildren protected property
Container::$scopedServices protected property
Container::$scopes protected property
Container::$scopeStacks protected property
Container::$services protected property
Container::addScope public function Adds a scope to the container. Overrides ContainerInterface::addScope
Container::camelize public static function Camelizes a string.
Container::enterScope public function This is called when you enter a scope Overrides ContainerInterface::enterScope
Container::getParameter public function Gets a parameter. Overrides ContainerInterface::getParameter 2
Container::getParameterBag public function Gets the service container parameter bag. 2
Container::hasParameter public function Checks if a parameter exists. Overrides ContainerInterface::hasParameter 2
Container::hasScope public function Returns whether this container has a certain scope Overrides ContainerInterface::hasScope
Container::initialized public function Returns true if the given service has actually been initialized Overrides IntrospectableContainerInterface::initialized
Container::isFrozen public function Returns true if the container parameter bag are frozen.
Container::isScopeActive public function Returns whether this scope is currently active Overrides ContainerInterface::isScopeActive
Container::leaveScope public function This is called to leave the current scope, and move back to the parent scope. Overrides ContainerInterface::leaveScope
Container::setParameter public function Sets a parameter. Overrides ContainerInterface::setParameter 2
Container::underscore public static function A string to underscore.
Container::__construct public function Constructor. 6
ContainerBuilder::$aliasDefinitions private property
ContainerBuilder::$compiler private property
ContainerBuilder::$definitions private property
ContainerBuilder::$extensionConfigs private property
ContainerBuilder::$extensions private property
ContainerBuilder::$extensionsByNs private property
ContainerBuilder::$obsoleteDefinitions private property
ContainerBuilder::$proxyInstantiator private property
ContainerBuilder::$resources private property
ContainerBuilder::$trackResources private property
ContainerBuilder::addAliases public function Adds the service aliases.
ContainerBuilder::addClassResource public function Adds the given class hierarchy as resources.
ContainerBuilder::addCompilerPass public function Adds a compiler pass.
ContainerBuilder::addDefinitions public function Adds the service definitions.
ContainerBuilder::addObjectResource public function Overrides Symfony\Component\DependencyInjection\ContainerBuilder::addObjectResource(). Overrides ContainerBuilder::addObjectResource
ContainerBuilder::addResource public function Adds a resource for this configuration.
ContainerBuilder::callMethod private function
ContainerBuilder::compile public function Compiles the container. Overrides Container::compile
ContainerBuilder::createService public function Creates a service for a service definition.
ContainerBuilder::findDefinition public function Gets a service definition by id or alias.
ContainerBuilder::findTaggedServiceIds public function Returns service ids for a given tag. Overrides TaggedContainerInterface::findTaggedServiceIds
ContainerBuilder::findTags public function Returns all tags the defined services use.
ContainerBuilder::get public function Gets a service. Overrides Container::get
ContainerBuilder::getAlias public function Gets an alias.
ContainerBuilder::getAliases public function Gets all defined aliases.
ContainerBuilder::getCompiler public function Returns the compiler.
ContainerBuilder::getCompilerPassConfig public function Returns the compiler pass config which can then be modified.
ContainerBuilder::getDefinition public function Gets a service definition.
ContainerBuilder::getDefinitions public function Gets all service definitions.
ContainerBuilder::getExtension public function Returns an extension by alias or namespace.
ContainerBuilder::getExtensionConfig public function Returns the configuration array for the given extension.
ContainerBuilder::getExtensions public function Returns all registered extensions.
ContainerBuilder::getProxyInstantiator private function Retrieves the currently set proxy instantiator or instantiates one.
ContainerBuilder::getResources public function Returns an array of resources loaded to build this configuration.
ContainerBuilder::getScopeChildren public function Returns all Scope children.
ContainerBuilder::getScopes public function Returns all Scopes.
ContainerBuilder::getServiceConditionals public static function Returns the Service Conditionals.
ContainerBuilder::getServiceIds public function Gets all service ids. Overrides Container::getServiceIds
ContainerBuilder::has public function Returns true if the given service is defined. Overrides Container::has
ContainerBuilder::hasAlias public function Returns true if an alias exists under the given identifier.
ContainerBuilder::hasDefinition public function Returns true if a service definition exists under the given identifier.
ContainerBuilder::hasExtension public function Checks if we have an extension.
ContainerBuilder::isTrackingResources public function Checks if resources are tracked.
ContainerBuilder::loadFromExtension public function Loads the configuration for an extension.
ContainerBuilder::merge public function Merges a ContainerBuilder with the current ContainerBuilder configuration.
ContainerBuilder::prependExtensionConfig public function Prepends a config array to the configs of the given extension.
ContainerBuilder::register public function Registers a service definition.
ContainerBuilder::registerExtension public function Registers an extension.
ContainerBuilder::removeAlias public function Removes an alias.
ContainerBuilder::removeDefinition public function Removes a service definition.
ContainerBuilder::resolveServices public function Replaces service references by the real service instance.
ContainerBuilder::set public function Overrides Symfony\Component\DependencyInjection\ContainerBuilder::set(). Overrides ContainerBuilder::set
ContainerBuilder::setAlias public function Sets an alias for an existing service.
ContainerBuilder::setAliases public function Sets the service aliases.
ContainerBuilder::setDefinition public function Sets a service definition.
ContainerBuilder::setDefinitions public function Sets the service definitions.
ContainerBuilder::setProxyInstantiator public function Sets the instantiator to be used when fetching proxies.
ContainerBuilder::setResources public function Sets the resources for this configuration.
ContainerBuilder::setResourceTracking public function Sets the track resources flag.
ContainerBuilder::shareService private function Shares a given service in the container
ContainerBuilder::synchronize private function Synchronizes a service change.
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE constant
ContainerInterface::IGNORE_ON_INVALID_REFERENCE constant
ContainerInterface::NULL_ON_INVALID_REFERENCE constant
ContainerInterface::SCOPE_CONTAINER constant
ContainerInterface::SCOPE_PROTOTYPE constant