8.3.x Entity.php public Entity::getCacheTagsToInvalidate()
8.0.x Entity.php public Entity::getCacheTagsToInvalidate()
8.1.x Entity.php public Entity::getCacheTagsToInvalidate()
8.2.x Entity.php public Entity::getCacheTagsToInvalidate()
8.4.x Entity.php public Entity::getCacheTagsToInvalidate()

Returns the cache tags that should be used to invalidate caches.

This will not return additional cache tags added through addCacheTags().

Return value

string[] Set of cache tags.

Overrides EntityInterface::getCacheTagsToInvalidate

See also

\Drupal\Core\Cache\RefinableCacheableDependencyInterface::addCacheTags()

\Drupal\Core\Cache\CacheableDependencyInterface::getCacheTags()

2 calls to Entity::getCacheTagsToInvalidate()
Entity::getCacheTags in core/lib/Drupal/Core/Entity/Entity.php
The cache tags associated with this object.
Entity::invalidateTagsOnSave in core/lib/Drupal/Core/Entity/Entity.php
Invalidates an entity's cache tags upon save.
3 methods override Entity::getCacheTagsToInvalidate()
ConfigEntityBase::getCacheTagsToInvalidate in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Returns the cache tags that should be used to invalidate caches.
Item::getCacheTagsToInvalidate in core/modules/aggregator/src/Entity/Item.php
Returns the cache tags that should be used to invalidate caches.
Shortcut::getCacheTagsToInvalidate in core/modules/shortcut/src/Entity/Shortcut.php
Returns the cache tags that should be used to invalidate caches.

File

core/lib/Drupal/Core/Entity/Entity.php, line 468

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function getCacheTagsToInvalidate() {
  // @todo Add bundle-specific listing cache tag?
  //   https://www.drupal.org/node/2145751
  if ($this->isNew()) {
    return [];
  }
  return [$this->entityTypeId . ':' . $this->id()];
}