private function ControllerBase::container

private ControllerBase::container()

Returns the service container.

This method is marked private to prevent sub-classes from retrieving services from the container through it. Instead, \Drupal\Core\DependencyInjection\ContainerInjectionInterface should be used for injecting services.

Return value

\Symfony\Component\DependencyInjection\ContainerInterface $container The service container.

File

core/lib/Drupal/Core/Controller/ControllerBase.php, line 315

Class

ControllerBase
Utility base class for thin controllers.

Namespace

Drupal\Core\Controller

Code

private function container() {
  return \Drupal::getContainer();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Controller!ControllerBase.php/function/ControllerBase::container/8.1.x