You are here

public function EntityManager::clearCachedDefinitions in Drupal 8

Overrides CachedDiscoveryInterface::clearCachedDefinitions

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityTypeManagerInterface::clearCachedDefinitions() instead.

See also

https://www.drupal.org/node/2549139

File

core/lib/Drupal/Core/Entity/EntityManager.php, line 30

Class

EntityManager
Provides a wrapper around many other services relating to entities.

Namespace

Drupal\Core\Entity

Code

public function clearCachedDefinitions() {
  @trigger_error('EntityManagerInterface::clearCachedDefinitions() is deprecated in 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\Entity\\EntityTypeManagerInterface::clearCachedDefinitions() instead. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
  $this->container
    ->get('entity_type.manager')
    ->clearCachedDefinitions();

  // @todo None of these are plugin managers, and they should not co-opt
  //   this method for managing its caches. Remove in
  //   https://www.drupal.org/node/2549143.
  $this->container
    ->get('entity_type.bundle.info')
    ->clearCachedBundles();
  $this->container
    ->get('entity_field.manager')
    ->clearCachedFieldDefinitions();
  $this->container
    ->get('entity_type.repository')
    ->clearCachedDefinitions();
}