function EntityTypeBundleInfo::clearCachedBundles

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php \Drupal\Core\Entity\EntityTypeBundleInfo::clearCachedBundles()
  2. 10 core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php \Drupal\Core\Entity\EntityTypeBundleInfo::clearCachedBundles()
  3. 9 core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php \Drupal\Core\Entity\EntityTypeBundleInfo::clearCachedBundles()

Clears static and persistent bundles.

Overrides EntityTypeBundleInfoInterface::clearCachedBundles

File

core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php, line 121

Class

EntityTypeBundleInfo
Provides discovery and retrieval of entity type bundles.

Namespace

Drupal\Core\Entity

Code

public function clearCachedBundles() {
  $this->bundleInfo = [];
  Cache::invalidateTags([
    'entity_bundles',
  ]);
  // Entity bundles are exposed as data types, clear that cache too.
  $this->typedDataManager
    ->clearCachedDefinitions();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.