protected function JsonapiParse::groupIncludes in JSON:API Include 8
Group include.
Parameters
object|array $object: The input data.
Return value
array The includes data.
1 call to JsonapiParse::groupIncludes()
- JsonapiParse::parseJsonContent in src/
JsonapiParse.php - Parse json content.
File
- src/
JsonapiParse.php, line 61
Class
- JsonapiParse
- Class JsonapiParse.
Namespace
Drupal\jsonapi_includeCode
protected function groupIncludes($object) {
$result = [];
$included = !empty($object['included']) ? $object['included'] : [];
array_walk($included, function ($resource, $index) use (&$result) {
$result[$resource['type']][$resource['id']] = $resource;
});
return $result;
}