You are here

public static function Drupal::getContainer in Service Container 7.2

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

Returns the currently active global container.

Return value

\Drupal\service_container\DependencyInjection\ContainerInterface

Deprecated

This method is only useful for the testing environment. It should not be used otherwise.

4 calls to Drupal::getContainer()
DependencySerializationTrait::__wakeup in lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php
ServiceContainerAnnotationDiscoveryIntegrationTest::setUp in modules/providers/service_container_annotation_discovery/lib/Drupal/service_container_annotation_discovery/Tests/ServiceContainerAnnotationDiscoveryIntegrationTest.php
ServiceContainerCToolsIntegrationTest::setUp in lib/Drupal/service_container/Tests/ServiceContainerCToolsIntegrationTest.php
ServiceContainerIntegrationTestBase::setUp in lib/Drupal/service_container/Tests/ServiceContainerIntegrationTestBase.php

File

lib/Drupal.php, line 35
Contains Drupal 7 foreward compatibility layer for Drupal 8.

Class

Drupal
Static Service Container wrapper.

Code

public static function getContainer() {
  return static::$container;
}