You are here

protected function CacheableDependencyTrait::setCacheability in JSON:API 8

Sets cacheability; useful for value object constructors.

Parameters

\Drupal\Core\Cache\CacheableDependencyInterface $cacheability: The cacheability to set.

Return value

$this

7 calls to CacheableDependencyTrait::setCacheability()
EntityNormalizerValue::__construct in src/Normalizer/Value/EntityNormalizerValue.php
Instantiate a EntityNormalizerValue object.
FieldItemNormalizerValue::__construct in src/Normalizer/Value/FieldItemNormalizerValue.php
Instantiate a FieldItemNormalizerValue object.
FieldNormalizerValue::__construct in src/Normalizer/Value/FieldNormalizerValue.php
Instantiate a FieldNormalizerValue object.
IncludeOnlyRelationshipNormalizerValue::__construct in src/Normalizer/Value/IncludeOnlyRelationshipNormalizerValue.php
Instantiate a IncludeOnlyRelationshipNormalizerValue object.
NullFieldNormalizerValue::__construct in src/Normalizer/Value/NullFieldNormalizerValue.php
Instantiate a FieldNormalizerValue object.

... See full list

File

src/Normalizer/CacheableDependencyTrait.php, line 45

Class

CacheableDependencyTrait
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.

Namespace

Drupal\jsonapi\Normalizer

Code

protected function setCacheability(CacheableDependencyInterface $cacheability) {
  $this->cacheContexts = $cacheability
    ->getCacheContexts();
  $this->cacheTags = $cacheability
    ->getCacheTags();
  $this->cacheMaxAge = $cacheability
    ->getCacheMaxAge();
  return $this;
}