You are here

protected function ControllerBase::entityManager in Drupal 8

Retrieves the entity manager service.

Return value

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

Deprecated

in drupal:8.0.0 and is removed from 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 133

Class

ControllerBase
Utility base class for thin controllers.

Namespace

Drupal\Core\Controller

Code

protected function entityManager() {
  @trigger_error('ControllerBase::getEntityManager() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use ::getEntityTypeManager() instead. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
  if (!$this->entityManager) {
    $this->entityManager = $this
      ->container()
      ->get('entity.manager');
  }
  return $this->entityManager;
}