You are here

public function ResourceObjectData::__construct in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php \Drupal\jsonapi\JsonApiResource\ResourceObjectData::__construct()
  2. 9 core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php \Drupal\jsonapi\JsonApiResource\ResourceObjectData::__construct()

ResourceObjectData constructor.

Parameters

\Drupal\jsonapi\JsonApiResource\ResourceObject[]|\Drupal\jsonapi\Exception\EntityAccessDeniedHttpException[] $data: Resource objects that are the primary data for the response.

int $cardinality: The number of resources that this collection may contain.

See also

\Drupal\jsonapi\JsonApiResource\Data::__construct

File

core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php, line 29

Class

ResourceObjectData
Represents the primary data for individual and collection documents.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function __construct($data, $cardinality = -1) {
  assert(Inspector::assertAllObjects($data, ResourceObject::class, EntityAccessDeniedHttpException::class));
  parent::__construct($data, $cardinality);
}