You are here

protected static function ResourceObjectNormalizer::buildEmptyNormalization in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php \Drupal\jsonapi\Normalizer\ResourceObjectNormalizer::buildEmptyNormalization()

Builds the empty normalization structure for cache misses.

Parameters

\Drupal\jsonapi\JsonApiResource\ResourceObject $object: The resource object being normalized.

Return value

array The normalization structure as defined in ::getNormalization().

See also

::getNormalization()

1 call to ResourceObjectNormalizer::buildEmptyNormalization()
ResourceObjectNormalizer::getNormalization in core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php
Normalizes an entity using the given fieldset.

File

core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php, line 149

Class

ResourceObjectNormalizer
Converts the JSON:API module ResourceObject into a JSON:API array structure.

Namespace

Drupal\jsonapi\Normalizer

Code

protected static function buildEmptyNormalization(ResourceObject $object) {
  return [
    ResourceObjectNormalizationCacher::RESOURCE_CACHE_SUBSET_BASE => [
      'type' => CacheableNormalization::permanent($object
        ->getResourceType()
        ->getTypeName()),
      'id' => CacheableNormalization::permanent($object
        ->getId()),
    ],
    ResourceObjectNormalizationCacher::RESOURCE_CACHE_SUBSET_FIELDS => [],
  ];
}