You are here

public function CacheableNormalization::withCacheableDependency in JSON:API 8.2

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

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);
}