function RelationshipData::__construct

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

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