function EntityBase::invalidateTagsOnDelete
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::invalidateTagsOnDelete()
- 10 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::invalidateTagsOnDelete()
- 11.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::invalidateTagsOnDelete()
Invalidates an entity's cache tags upon delete.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
1 call to EntityBase::invalidateTagsOnDelete()
- EntityBase::postDelete in core/
lib/ Drupal/ Core/ Entity/ EntityBase.php - Acts on deleted entities before the delete hook is invoked.
1 method overrides EntityBase::invalidateTagsOnDelete()
- ConfigEntityBase::invalidateTagsOnDelete in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityBase.php - Override to never invalidate the individual entities' cache tags; the config system already invalidates them.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityBase.php, line 598
Class
- EntityBase
- Defines a base entity class.
Namespace
Drupal\Core\EntityCode
protected static function invalidateTagsOnDelete(EntityTypeInterface $entity_type, array $entities) {
$tags = $entity_type->getListCacheTags();
foreach ($entities as $entity) {
// An entity was deleted: invalidate its own cache tag, but also its list
// cache tags. (A deleted entity may cause changes in a paged list on
// other pages than the one it's on. The one it's on is handled by its own
// cache tag, but subsequent list pages would not be invalidated, hence we
// must invalidate its list cache tags as well.)
$tags = Cache::mergeTags($tags, $entity->getCacheTagsToInvalidate());
$tags = Cache::mergeTags($tags, $entity->getListCacheTagsToInvalidate());
}
Cache::invalidateTags($tags);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.