protected function ControllerBase::entityManager

protected ControllerBase::entityManager()

Retrieves the entity manager service.

Return value

\Drupal\Core\Entity\EntityManagerInterface The entity manager service.

Deprecated

in Drupal 8.0.0, will be removed before Drupal 9.0.0. Most of the time static::entityTypeManager() is supposed to be used instead.

File

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

Class

ControllerBase
Utility base class for thin controllers.

Namespace

Drupal\Core\Controller

Code

protected function entityManager() {
  if (!$this->entityManager) {
    $this->entityManager = $this->container()->get('entity.manager');
  }
  return $this->entityManager;
}

© 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::entityManager/8.1.x