public function resolve($data,
$include_parameter) { assert($data instanceof ResourceObject ||
$data instanceof ResourceObjectData
);
$data =
$data instanceof ResourceObjectData ?
$data :
new ResourceObjectData([$data], 1
);
$include_tree =
static::
toIncludeTree($data,
$include_parameter);
return IncludedData::
deduplicate($this->
resolveIncludeTree($include_tree,
$data));
} /**
* Receives a tree of include field names and resolves resources for it.
*
* This method takes a tree of relationship field names and JSON:API Data
* object. For the top-level of the tree and for each entity in the
* collection, it gets the target entity type and IDs for each relationship
* field. The method then loads all of those targets and calls itself
* recursively with the next level of the tree and those loaded resources.
*
* @param array $include_tree
* The include paths, represented as a tree.
* @param \Drupal\jsonapi\JsonApiResource\Data $data
* The entity collection from which includes should be resolved.
* @param \Drupal\jsonapi\JsonApiResource\Data|null $includes
* (Internal use only) Any prior resolved includes.
*
* @return \Drupal\jsonapi\JsonApiResource\Data
* A JSON:API Data of included items.
*
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* Thrown if an included entity type doesn't exist.
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* Thrown if a storage handler couldn't be loaded.
*/