function ResourceObjectNormalizationCacher::mergeCacheableDependencies

Same name in other branches
  1. 9 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::mergeCacheableDependencies()
  2. 8.9.x core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::mergeCacheableDependencies()
  3. 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()

1 call to ResourceObjectNormalizationCacher::mergeCacheableDependencies()
ResourceObjectNormalizationCacher::set in core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php
Writes a normalization to cache.

File

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

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.