You are here

public function Sql::getCacheTags in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getCacheTags()

The cache tags associated with this object.

When this object is modified, these cache tags will be invalidated.

Return value

string[] A set of cache tags.

Overrides QueryPluginBase::getCacheTags

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1677

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public function getCacheTags() {
  $tags = [];

  // Add cache tags for each row, if there is an entity associated with it.
  if (!$this->hasAggregate) {
    foreach ($this
      ->getAllEntities() as $entity) {
      $tags = Cache::mergeTags($entity
        ->getCacheTags(), $tags);
    }
  }
  return $tags;
}