You are here

class Container in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/dependency-injection/Container.php \Symfony\Component\DependencyInjection\Container
  2. 8 core/lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container
  3. 8 core/lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container
  4. 8 vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php \Symfony\Component\DependencyInjection\Container
  5. 8 core/lib/Drupal/Core/Render/Element/Container.php \Drupal\Core\Render\Element\Container
Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container

Extends the Drupal container to set the service ID on the created object.

Hierarchy

Expanded class hierarchy of Container

12 files declare their use of Container
BlockPageVariantTest.php in core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php
Contains \Drupal\Tests\block\Unit\Plugin\DisplayVariant\BlockPageVariantTest.
CacheTagsInvalidatorTest.php in core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
Contains \Drupal\Tests\Core\Cache\CacheTagsInvalidatorTest.
ContainerTest.php in core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php
Contains \Drupal\Tests\Core\DependencyInjection\ContainerTest.
DefaultMenuLinkTreeManipulatorsTest.php in core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
Contains \Drupal\Tests\Core\Menu\DefaultMenuLinkTreeManipulatorsTest.
DependencySerializationTest.php in core/tests/Drupal/Tests/Core/DependencyInjection/DependencySerializationTest.php
Contains \Drupal\Tests\Core\DependencyInjection\DependencySerializationTest.

... See full list

5 string references to 'Container'
field.field.taxonomy_term.forums.forum_container.yml in core/modules/forum/config/install/field.field.taxonomy_term.forums.forum_container.yml
core/modules/forum/config/install/field.field.taxonomy_term.forums.forum_container.yml
Kernel::getContainerBaseClass in vendor/symfony/http-kernel/Kernel.php
Gets the container's base class.
PhpDumper::dump in vendor/symfony/dependency-injection/Dumper/PhpDumper.php
Dumps the service container as a PHP class.
PhpDumperTest::testDump in vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php
SearchExcerptTest::testSearchExcerptSimplified in core/modules/search/src/Tests/SearchExcerptTest.php
Tests search_excerpt() with search keywords matching simplified words.

File

core/lib/Drupal/Core/DependencyInjection/Container.php, line 16
Contains \Drupal\Core\DependencyInjection\Container.

Namespace

Drupal\Core\DependencyInjection
View source
class Container extends DrupalContainer {

  /**
   * {@inheritdoc}
   */
  public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) {
    parent::set($id, $service, $scope);

    // Ensure that the _serviceId property is set on synthetic services as well.
    if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
      $this->services[$id]->_serviceId = $id;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function __sleep() {
    assert(FALSE, 'The container was serialized.');
    return array_keys(get_object_vars($this));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Container::$aliases protected property The aliases of the container.
Container::$frozen protected property Whether the container parameters can still be changed.
Container::$loading protected property The currently loading services.
Container::$parameters protected property The parameters of the container.
Container::$privateServices protected property The instantiated private services.
Container::$serviceDefinitions protected property The service definitions of the container.
Container::$services protected property The instantiated services.
Container::addScope public function Adds a scope to the container. Overrides ContainerInterface::addScope
Container::createService protected function Creates a service from a service definition. 1
Container::enterScope public function Enters the given scope. Overrides ContainerInterface::enterScope
Container::get public function Gets a service. Overrides ContainerInterface::get 2
Container::getAlternatives protected function Provides alternatives for a given array and key.
Container::getParameter public function Gets a parameter. Overrides ContainerInterface::getParameter
Container::getParameterAlternatives protected function Provides alternatives in case a parameter was not found.
Container::getServiceAlternatives protected function Provides alternatives in case a service was not found.
Container::getServiceIds public function Gets all defined service IDs.
Container::has public function Returns true if the given service is defined. Overrides ContainerInterface::has
Container::hasParameter public function Checks if a parameter exists. Overrides ContainerInterface::hasParameter
Container::hasScope public function Whether this container has the given scope. Overrides ContainerInterface::hasScope
Container::initialized public function Check for whether or not a service has been initialized. Overrides IntrospectableContainerInterface::initialized
Container::isScopeActive public function Determines whether the given scope is currently active. Overrides ContainerInterface::isScopeActive
Container::leaveScope public function Leaves the current scope, and re-enters the parent scope. Overrides ContainerInterface::leaveScope
Container::resolveServicesAndParameters protected function Resolves arguments that represent services or variables to the real values. 1
Container::set public function Sets a service. Overrides Container::set
Container::setParameter public function Sets a parameter. Overrides ContainerInterface::setParameter
Container::__construct public function Constructs a new Container instance. 1
Container::__sleep public function
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