You are here

public static function Drupal::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. Use \Drupal::entityTypeManager() instead in most cases. If the needed method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the deprecated \Drupal\Core\Entity\EntityManager to find the correct interface or service.

6 calls to Drupal::entityManager()
DrupalTest::testEntityManager in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the entityManager() method.
EntityBase::entityManager in core/lib/Drupal/Core/Entity/EntityBase.php
Gets the entity manager.
EntityForm::__get in core/lib/Drupal/Core/Entity/EntityForm.php
entity_render_cache_clear in core/includes/entity.inc
Clears the entity render cache for all entity types.
FieldAPIHandlerTrait::getEntityManager in core/modules/views/src/FieldAPIHandlerTrait.php
Returns the entity manager.

... See full list

File

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

Class

Drupal
Static Service Container wrapper.

Code

public static function entityManager() {
  @trigger_error("\\Drupal::entityManager() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal::entityTypeManager() instead in most cases. If the needed method is not on \\Drupal\\Core\\Entity\\EntityTypeManagerInterface, see the deprecated \\Drupal\\Core\\Entity\\EntityManager to find the correct interface or service. See https://www.drupal.org/node/2549139", E_USER_DEPRECATED);
  return static::getContainer()
    ->get('entity.manager');
}