You are here

public function EntityNormalizerValue::getIncludes in JSON:API 8

Gets a flattened list of includes in all the chain.

Return value

\Drupal\jsonapi\Normalizer\Value\EntityNormalizerValue[] The array of included relationships.

1 call to EntityNormalizerValue::getIncludes()
EntityNormalizerValue::rasterizeIncludes in src/Normalizer/Value/EntityNormalizerValue.php
Get the includes.

File

src/Normalizer/Value/EntityNormalizerValue.php, line 142

Class

EntityNormalizerValue
Helps normalize entities in compliance with the JSON API spec.

Namespace

Drupal\jsonapi\Normalizer\Value

Code

public function getIncludes() {
  $nested_includes = array_map(function ($include) {
    return $include
      ->getIncludes();
  }, $this->includes);
  return array_reduce(array_filter($nested_includes), function ($carry, $item) {
    return array_merge($carry, $item);
  }, $this->includes);
}