You are here

public function CacheableNormalization::withCacheableDependency in Drupal 8

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

Gets a new CacheableNormalization with an additional dependency.

Parameters

\Drupal\Core\Cache\CacheableDependencyInterface $dependency: The new cacheable dependency.

Return value

static A new object based on the current value with an additional cacheable dependency.

File

core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php, line 90

Class

CacheableNormalization
Use to store normalized data and its cacheability.

Namespace

Drupal\jsonapi\Normalizer\Value

Code

public function withCacheableDependency(CacheableDependencyInterface $dependency) {
  return new static(CacheableMetadata::createFromObject($this)
    ->addCacheableDependency($dependency), $this->normalization);
}