function ResourceObjectNormalizationCacher::mergeCacheableDependencies

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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;
}

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