public function EntityFieldManager::clearCachedFieldDefinitions

public EntityFieldManager::clearCachedFieldDefinitions()

Clears static and persistent field definition caches.

Overrides EntityFieldManagerInterface::clearCachedFieldDefinitions

File

core/lib/Drupal/Core/Entity/EntityFieldManager.php, line 534

Class

EntityFieldManager
Manages the discovery of entity fields.

Namespace

Drupal\Core\Entity

Code

public function clearCachedFieldDefinitions() {
  $this->baseFieldDefinitions = [];
  $this->fieldDefinitions = [];
  $this->fieldStorageDefinitions = [];
  $this->fieldMap = [];
  $this->fieldMapByFieldType = [];
  $this->entityDisplayRepository->clearDisplayModeInfo();
  $this->extraFields = [];
  Cache::invalidateTags(['entity_field_info']);
  // The typed data manager statically caches prototype objects with injected
  // definitions, clear those as well.
  $this->typedDataManager->clearCachedDefinitions();
}

© 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!Entity!EntityFieldManager.php/function/EntityFieldManager::clearCachedFieldDefinitions/8.1.x