You are here

public function RelationshipData::__construct in Drupal 9

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

RelationshipData constructor.

Parameters

\Drupal\jsonapi\JsonApiResource\ResourceIdentifier[] $data: Resource objects that are the primary data for the response.

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

Overrides Data::__construct

See also

\Drupal\jsonapi\JsonApiResource\Data::__construct

File

core/modules/jsonapi/src/JsonApiResource/RelationshipData.php, line 28

Class

RelationshipData
Represents the data of a relationship object or relationship document.

Namespace

Drupal\jsonapi\JsonApiResource

Code

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