public function CacheableNormalization::withCacheableDependency in Drupal 9
Same name and namespace in other branches
- 8 core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php \Drupal\jsonapi\Normalizer\Value\CacheableNormalization::withCacheableDependency()
 - 10 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\ValueCode
public function withCacheableDependency(CacheableDependencyInterface $dependency) {
  return new static(CacheableMetadata::createFromObject($this)
    ->addCacheableDependency($dependency), $this->normalization);
}