class JsonApiDocumentTopLevel in JSON:API 8
Represents a JSON API document's "top level".
@internal
@todo Add the missing required members: 'error' and 'meta' or document why not. @todo Add support for the missing optional members: 'jsonapi', 'links' and 'included' or document why not.
Hierarchy
- class \Drupal\jsonapi\Resource\JsonApiDocumentTopLevel
Expanded class hierarchy of JsonApiDocumentTopLevel
See also
http://jsonapi.org/format/#document-top-level
8 files declare their use of JsonApiDocumentTopLevel
- EntityResource.php in src/
Controller/ EntityResource.php - EntityResourceTest.php in tests/
src/ Kernel/ Controller/ EntityResourceTest.php - EntityToJsonApi.php in src/
EntityToJsonApi.php - JsonApiDocumentTopLevelNormalizer.php in src/
Normalizer/ JsonApiDocumentTopLevelNormalizer.php - JsonApiDocumentTopLevelNormalizerTest.php in tests/
src/ Kernel/ Normalizer/ JsonApiDocumentTopLevelNormalizerTest.php
File
- src/
Resource/ JsonApiDocumentTopLevel.php, line 15
Namespace
Drupal\jsonapi\ResourceView source
class JsonApiDocumentTopLevel {
/**
* The data to normalize.
*
* @var \Drupal\Core\Entity\EntityInterface|\Drupal\jsonapi\EntityCollection
*/
protected $data;
/**
* Instantiates a JsonApiDocumentTopLevel object.
*
* @param \Drupal\Core\Entity\EntityInterface|\Drupal\jsonapi\EntityCollection $data
* The data to normalize. It can be either a straight up entity or a
* collection of entities.
*/
public function __construct($data) {
$this->data = $data;
}
/**
* Gets the data.
*
* @return \Drupal\Core\Entity\EntityInterface|\Drupal\jsonapi\EntityCollection
* The data.
*/
public function getData() {
return $this->data;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JsonApiDocumentTopLevel:: |
protected | property | The data to normalize. | |
JsonApiDocumentTopLevel:: |
public | function | Gets the data. | |
JsonApiDocumentTopLevel:: |
public | function | Instantiates a JsonApiDocumentTopLevel object. |