You are here

protected function EntityResource::buildWrappedResponse in JSON:API 8

Same name and namespace in other branches
  1. 8.2 src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::buildWrappedResponse()

Builds a response with the appropriate wrapped document.

Parameters

mixed $data: The data to wrap.

int $response_code: The response code.

array $headers: An array of response headers.

Return value

\Drupal\jsonapi\ResourceResponse The response.

6 calls to EntityResource::buildWrappedResponse()
EntityResource::createIndividual in src/Controller/EntityResource.php
Creates an individual entity.
EntityResource::getIndividual in src/Controller/EntityResource.php
Gets the individual entity.
EntityResource::getRelated in src/Controller/EntityResource.php
Gets the related resource.
EntityResource::getRelationship in src/Controller/EntityResource.php
Gets the relationship of an entity.
EntityResource::patchIndividual in src/Controller/EntityResource.php
Patches an individual entity.

... See full list

File

src/Controller/EntityResource.php, line 894

Class

EntityResource
Process all entity requests.

Namespace

Drupal\jsonapi\Controller

Code

protected function buildWrappedResponse($data, $response_code = 200, array $headers = []) {
  return new ResourceResponse(new JsonApiDocumentTopLevel($data), $response_code, $headers);
}