You are here

public function Response::addViolations in GraphQL 8.4

Adds multiple violations.

Parameters

string[]|\Drupal\Core\StringTranslation\TranslatableMarkup[] $messages: Violation messages.

array $properties: Other properties related to the violation.

Overrides ResponseInterface::addViolations

File

src/GraphQL/Response/Response.php, line 30

Class

Response
Base class for responses containing the violations.

Namespace

Drupal\graphql\GraphQL\Response

Code

public function addViolations(array $messages, array $properties = []) : void {
  foreach ($messages as $message) {
    $this
      ->addViolation($message, $properties);
  }
}