function EntityResource::getIncludes
Same name in other branches
- 9 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getIncludes()
- 8.9.x core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getIncludes()
- 11.x 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 1127
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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.