Mercurial > hg > cmmr2012-drupal-site
annotate core/modules/jsonapi/src/JsonApiResource/IncludedData.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 |
rev | line source |
---|---|
Chris@5 | 1 <?php |
Chris@5 | 2 |
Chris@5 | 3 namespace Drupal\jsonapi\JsonApiResource; |
Chris@5 | 4 |
Chris@5 | 5 use Drupal\Component\Assertion\Inspector; |
Chris@5 | 6 use Drupal\jsonapi\Exception\EntityAccessDeniedHttpException; |
Chris@5 | 7 |
Chris@5 | 8 /** |
Chris@5 | 9 * Represents the included member of a JSON:API document. |
Chris@5 | 10 * |
Chris@5 | 11 * @internal JSON:API maintains no PHP API. The API is the HTTP API. This class |
Chris@5 | 12 * may change at any time and could break any dependencies on it. |
Chris@5 | 13 * |
Chris@5 | 14 * @see https://www.drupal.org/project/jsonapi/issues/3032787 |
Chris@5 | 15 * @see jsonapi.api.php |
Chris@5 | 16 */ |
Chris@5 | 17 class IncludedData extends ResourceObjectData { |
Chris@5 | 18 |
Chris@5 | 19 /** |
Chris@5 | 20 * IncludedData constructor. |
Chris@5 | 21 * |
Chris@5 | 22 * @param \Drupal\jsonapi\JsonApiResource\ResourceObject[]|\Drupal\jsonapi\Exception\EntityAccessDeniedHttpException[] $data |
Chris@5 | 23 * Resource objects that are the primary data for the response. |
Chris@5 | 24 * |
Chris@5 | 25 * @see \Drupal\jsonapi\JsonApiResource\Data::__construct |
Chris@5 | 26 */ |
Chris@5 | 27 public function __construct($data) { |
Chris@5 | 28 assert(Inspector::assertAllObjects($data, ResourceObject::class, EntityAccessDeniedHttpException::class)); |
Chris@5 | 29 parent::__construct($data, -1); |
Chris@5 | 30 } |
Chris@5 | 31 |
Chris@5 | 32 } |