You are here

public function ErrorCollection::__construct in JSON:API 8.2

Instantiates an ErrorCollection object.

Parameters

\Symfony\Component\HttpKernel\Exception\HttpExceptionInterface[] $errors: The errors.

File

src/JsonApiResource/ErrorCollection.php, line 37

Class

ErrorCollection
To be used when the primary data is `errors`.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function __construct(array $errors) {
  assert(Inspector::assertAll(function ($error) {
    return $error instanceof HttpExceptionInterface;
  }, $errors));
  $this->errors = $errors;
}