public function EntityResource::getIncludes in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getIncludes()
- 10 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getIncludes()
Gets includes for the given response data.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request object.
\Drupal\jsonapi\JsonApiResource\ResourceObject|\Drupal\jsonapi\JsonApiResource\ResourceObjectData $data: The response data from which to resolve includes.
Return value
\Drupal\jsonapi\JsonApiResource\Data A Data object to be included or a NullData object if the request does not specify any include paths.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
6 calls to EntityResource::getIncludes()
- EntityResource::createIndividual in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Creates an individual entity.
- EntityResource::getCollection in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Gets the collection of entities.
- EntityResource::getIndividual in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Gets the individual entity.
- EntityResource::getRelated in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Gets the related resource.
- EntityResource::getRelationship in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Gets the relationship of an entity.
File
- core/
modules/ jsonapi/ src/ Controller/ EntityResource.php, line 1100
Class
- EntityResource
- Process all entity requests.
Namespace
Drupal\jsonapi\ControllerCode
public function getIncludes(Request $request, $data) {
assert($data instanceof ResourceObject || $data instanceof ResourceObjectData);
return $request->query
->has('include') && ($include_parameter = $request->query
->get('include')) && !empty($include_parameter) ? $this->includeResolver
->resolve($data, $include_parameter) : new NullIncludedData();
}