You are here

protected static function ResourceObjectNormalizationCacher::mergeCacheableDependencies in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::mergeCacheableDependencies()
  2. 10 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::mergeCacheableDependencies()

Determines the joint cacheability of all provided dependencies.

Parameters

\Drupal\Core\Cache\CacheableDependencyInterface|object[] $dependencies: The dependencies.

Return value

\Drupal\Core\Cache\CacheableMetadata The cacheability of all dependencies.

See also

\Drupal\Core\Cache\RefinableCacheableDependencyInterface::addCacheableDependency()

File

core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php, line 192

Class

ResourceObjectNormalizationCacher
Caches entity normalizations after the response has been sent.

Namespace

Drupal\jsonapi\EventSubscriber

Code

protected static function mergeCacheableDependencies(array $dependencies) {
  $merged_cacheability = new CacheableMetadata();
  array_walk($dependencies, function ($dependency) use ($merged_cacheability) {
    $merged_cacheability
      ->addCacheableDependency($dependency);
  });
  return $merged_cacheability;
}