You are here

class Container in Service Container 7

Same name in this branch
  1. 7 src/DependencyInjection/Container.php \Drupal\service_container\DependencyInjection\Container
  2. 7 lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container
  3. 7 lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container
  4. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Container.php \Symfony\Component\DependencyInjection\Container
  5. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php \Symfony\Component\DependencyInjection\Container
Same name and namespace in other branches
  1. 7.2 lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container

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

Hierarchy

  • class \Drupal\Core\DependencyInjection\Container extends \Symfony\Component\DependencyInjection\Container

Expanded class hierarchy of Container

2 string references to 'Container'
PhpDumper::dump in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Dumps the service container as a PHP class.
PhpDumperTest::testDump in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

File

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

Namespace

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

  /**
   * {@inheritdoc}
   */
  public function set($id, $service, $scope = SymfonyContainer::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() {
    trigger_error('The container was serialized.', E_USER_ERROR);
    return array_keys(get_object_vars($this));
  }

}

Members