You are here

public static function Drupal::getContainer in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal.php \Drupal::getContainer()

Returns the currently active global container.

Return value

\Symfony\Component\DependencyInjection\ContainerInterface|null

Throws

\Drupal\Core\DependencyInjection\ContainerNotInitializedException

31 calls to Drupal::getContainer()
BrowserTestBase::resetAll in core/modules/simpletest/src/BrowserTestBase.php
Resets all data structures after having enabled new modules.
Cache::getBins in core/lib/Drupal/Core/Cache/Cache.php
Gets all cache bin services.
ConfigInstallTest::installModules in core/modules/config/src/Tests/ConfigInstallTest.php
Installs a module.
ConfigOtherModuleTest::installModule in core/modules/config/src/Tests/ConfigOtherModuleTest.php
Installs a module.
ConfigOtherModuleTest::uninstallModule in core/modules/config/src/Tests/ConfigOtherModuleTest.php
Uninstalls a module.

... See full list

File

core/lib/Drupal.php, line 127
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function getContainer() {
  if (static::$container === NULL) {
    throw new ContainerNotInitializedException('\\Drupal::$container is not initialized yet. \\Drupal::setContainer() must be called with a real container.');
  }
  return static::$container;
}