function ResourceObjectData::__construct

Same name in other branches
  1. 9 core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php \Drupal\jsonapi\JsonApiResource\ResourceObjectData::__construct()
  2. 8.9.x core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php \Drupal\jsonapi\JsonApiResource\ResourceObjectData::__construct()
  3. 11.x 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.

Overrides Data::__construct

See also

\Drupal\jsonapi\JsonApiResource\Data::__construct

2 calls to ResourceObjectData::__construct()
IncludedData::__construct in core/modules/jsonapi/src/JsonApiResource/IncludedData.php
IncludedData constructor.
OmittedData::__construct in core/modules/jsonapi/src/JsonApiResource/OmittedData.php
OmittedData constructor.
2 methods override ResourceObjectData::__construct()
IncludedData::__construct in core/modules/jsonapi/src/JsonApiResource/IncludedData.php
IncludedData constructor.
OmittedData::__construct in core/modules/jsonapi/src/JsonApiResource/OmittedData.php
OmittedData constructor.

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.