You are here

function relation_clear_related_entities_cache in Relation 8.2

Same name and namespace in other branches
  1. 8 relation.module \relation_clear_related_entities_cache()
  2. 7 relation.module \relation_clear_related_entities_cache()

Clear the cache for a set of endpoints.

Parameters

\Drupal\Core\Field\FieldItemListInterface $endpoints: List of relation endpoint field items with entity_type and entity_id values in individual field items.

1 call to relation_clear_related_entities_cache()
relation_entity_delete in ./relation.module
Implements hook_entity_delete().

File

./relation.module, line 113
Describes relations between entities.

Code

function relation_clear_related_entities_cache(FieldItemListInterface $endpoints) {
  drupal_static_reset('relation_get_related_entity');
  foreach ($endpoints as $endpoint) {
    \Drupal::cache()
      ->delete('relation:' . $endpoint->target_type . ':' . $endpoint->target_id, 'cache', TRUE);
  }
}