You are here

protected function JsonapiParse::resolveRelationships in JSON:API Include 8

Resolve relationships.

Parameters

array|mixed $resource: The data for resolve.

Return value

array Result.

2 calls to JsonapiParse::resolveRelationships()
JsonapiParse::flattenIncluded in src/JsonapiParse.php
Flatten included.
JsonapiParse::parseResource in src/JsonapiParse.php
Parse Resource.

File

src/JsonapiParse.php, line 178

Class

JsonapiParse
Class JsonapiParse.

Namespace

Drupal\jsonapi_include

Code

protected function resolveRelationships($resource) {
  if (empty($resource['relationships'])) {
    return $resource;
  }
  foreach ($resource['relationships'] as $key => $value) {
    $resource[$key] = $this
      ->resolveRelationshipData($value);
  }
  unset($resource['relationships']);
  return $resource;
}