function CacheableNormalization::withCacheableDependency

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php \Drupal\jsonapi\Normalizer\Value\CacheableNormalization::withCacheableDependency()
  2. 10 core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php \Drupal\jsonapi\Normalizer\Value\CacheableNormalization::withCacheableDependency()
  3. 11.x 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);
}

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