You are here

protected static function CacheableDependenciesMergerTrait::mergeCacheableDependencies in JSON:API 8

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()

3 calls to CacheableDependenciesMergerTrait::mergeCacheableDependencies()
EntityNormalizerValue::__construct in src/Normalizer/Value/EntityNormalizerValue.php
Instantiate a EntityNormalizerValue object.
FieldNormalizerValue::__construct in src/Normalizer/Value/FieldNormalizerValue.php
Instantiate a FieldNormalizerValue object.
RelationshipItemNormalizerValue::__construct in src/Normalizer/Value/RelationshipItemNormalizerValue.php
Instantiates a RelationshipItemNormalizerValue object.

File

src/Normalizer/Value/CacheableDependenciesMergerTrait.php, line 25

Class

CacheableDependenciesMergerTrait
Trait for \Drupal\Core\Cache\CacheableDependencyInterface::setCacheability().

Namespace

Drupal\jsonapi\Normalizer\Value

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;
}