You are here

public function Entity::getCacheTagsToInvalidate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Entity.php \Drupal\Core\Entity\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 472
Contains \Drupal\Core\Entity\Entity.

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(),
  ];
}