protected function ParagraphsTypeIconUuidLookup::resolveCacheMiss

File

paragraphs/src/ParagraphsTypeIconUuidLookup.php, line 40

Class

ParagraphsTypeIconUuidLookup
A cache collector that caches IDs for the paragraphs_type entity icon UUIDs.

Namespace

Drupal\paragraphs

Code

protected function resolveCacheMiss($key) {
  $ids = $this->entityTypeManager
    ->getStorage('file')
    ->getQuery()
    ->condition('uuid', $key)
    ->accessCheck(TRUE)
    ->execute();

  // Only cache if there is a match, otherwise creating new entities would
  // require to invalidate the cache.
  $id = reset($ids);
  if ($id) {
    $this->storage[$key] = $id;
    $this
      ->persist($key);
  }
  return $id;
}