function ResourceObjectNormalizationCacher::get

Same name in other branches
  1. 9 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::get()
  2. 10 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::get()
  3. 11.x core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::get()

Reads an entity normalization from cache.

The returned normalization may only be a partial normalization because it was previously normalized with a sparse fieldset.

Parameters

\Drupal\jsonapi\JsonApiResource\ResourceObject $object: The resource object for which to generate a cache item.

Return value

array|false The cached normalization parts, or FALSE if not yet cached.

See also

\Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber::renderArrayToResponse()

File

core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php, line 80

Class

ResourceObjectNormalizationCacher
Caches entity normalizations after the response has been sent.

Namespace

Drupal\jsonapi\EventSubscriber

Code

public function get(ResourceObject $object) {
    $cached = $this->renderCache
        ->get(static::generateLookupRenderArray($object));
    return $cached ? $cached['#data'] : FALSE;
}

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