function EntityBase::getCacheTagsToInvalidate

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

Overrides EntityInterface::getCacheTagsToInvalidate

3 calls to EntityBase::getCacheTagsToInvalidate()
EntityBase::getCacheTags in core/lib/Drupal/Core/Entity/EntityBase.php
The cache tags associated with this object.
EntityBase::invalidateTagsOnSave in core/lib/Drupal/Core/Entity/EntityBase.php
Invalidates an entity's cache tags upon save.
File::invalidateTagsOnSave in core/modules/file/src/Entity/File.php
Invalidates an entity's cache tags upon save.
3 methods override EntityBase::getCacheTagsToInvalidate()
ConfigEntityBase::getCacheTagsToInvalidate in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
Returns the cache tags that should be used to invalidate caches.
PathAlias::getCacheTagsToInvalidate in core/modules/path_alias/src/Entity/PathAlias.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/EntityBase.php, line 472

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function getCacheTagsToInvalidate() {
    if ($this->isNew()) {
        return [];
    }
    return [
        $this->entityTypeId . ':' . $this->id(),
    ];
}

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