Skip to content
Snippets Groups Projects
Unverified Commit c1b9f954 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3039730 by ndobromirov, Wim Leers, e0ipso, l0ke, webchick, xjm: Include...

Issue #3039730 by ndobromirov, Wim Leers, e0ipso, l0ke, webchick, xjm: Include paths are resolved for every resource in a resource collection, instead of once per unique resource type
parent 8b80368c
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -176,11 +176,17 @@ protected static function toIncludeTree(ResourceObjectData $data, $include_param
$exploded_paths = array_map(function ($include_path) {
return array_map('trim', explode('.', $include_path));
}, $include_paths);
$resolved_paths = [];
$resolved_paths_per_resource_type = [];
/* @var \Drupal\jsonapi\JsonApiResource\ResourceIdentifierInterface $resource_object */
foreach ($data as $resource_object) {
$resolved_paths = array_merge($resolved_paths, static::resolveInternalIncludePaths($resource_object->getResourceType(), $exploded_paths));
$resource_type = $resource_object->getResourceType();
$resource_type_name = $resource_type->getTypeName();
if (isset($resolved_paths_per_resource_type[$resource_type_name])) {
continue;
}
$resolved_paths_per_resource_type[$resource_type_name] = static::resolveInternalIncludePaths($resource_type, $exploded_paths);
}
$resolved_paths = array_reduce($resolved_paths_per_resource_type, 'array_merge', []);
return static::buildTree($resolved_paths);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment