Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/jsonapi/src/JsonApiResource/RelationshipData.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\jsonapi\JsonApiResource; | |
4 | |
5 use Drupal\Component\Assertion\Inspector; | |
6 | |
7 /** | |
8 * Represents the data of a relationship object or relationship document. | |
9 * | |
10 * @internal JSON:API maintains no PHP API. The API is the HTTP API. This class | |
11 * may change at any time and could break any dependencies on it. | |
12 * | |
13 * @see https://www.drupal.org/project/jsonapi/issues/3032787 | |
14 * @see jsonapi.api.php | |
15 */ | |
16 class RelationshipData extends Data { | |
17 | |
18 /** | |
19 * RelationshipData constructor. | |
20 * | |
21 * @param \Drupal\jsonapi\JsonApiResource\ResourceIdentifier[] $data | |
22 * Resource objects that are the primary data for the response. | |
23 * @param int $cardinality | |
24 * The number of ResourceIdentifiers that this collection may contain. | |
25 * | |
26 * @see \Drupal\jsonapi\JsonApiResource\Data::__construct | |
27 */ | |
28 public function __construct(array $data, $cardinality = -1) { | |
29 assert(Inspector::assertAllObjects($data, ResourceIdentifier::class)); | |
30 parent::__construct($data, $cardinality); | |
31 } | |
32 | |
33 } |