class Response in GraphQL 8.4
Base class for responses containing the violations.
Hierarchy
- class \Drupal\graphql\GraphQL\Response\Response implements ResponseInterface
Expanded class hierarchy of Response
3 files declare their use of Response
- ArticleResponse.php in examples/
graphql_composable/ src/ GraphQL/ Response/ ArticleResponse.php - ArticleResponse.php in examples/
graphql_composable/ src/ Wrappers/ Response/ ArticleResponse.php - PasswordReset.php in src/
Plugin/ GraphQL/ DataProducer/ User/ PasswordReset.php
1 string reference to 'Response'
- ComposableSchemaExampleExtension::registerResolvers in examples/
graphql_composable/ src/ Plugin/ GraphQL/ SchemaExtension/ ComposableSchemaExampleExtension.php - Registers type and field resolvers in the shared registry.
File
- src/
GraphQL/ Response/ Response.php, line 10
Namespace
Drupal\graphql\GraphQL\ResponseView source
class Response implements ResponseInterface {
/**
* List of violations.
*
* @var array
*/
protected $violations = [];
/**
* {@inheritdoc}
*/
public function addViolation($message, array $properties = []) : void {
$properties['message'] = (string) $message;
$this->violations[] = $properties;
}
/**
* {@inheritdoc}
*/
public function addViolations(array $messages, array $properties = []) : void {
foreach ($messages as $message) {
$this
->addViolation($message, $properties);
}
}
/**
* {@inheritdoc}
*/
public function getViolations() : array {
return $this->violations;
}
/**
* {@inheritdoc}
*/
public function mergeViolations(ResponseInterface $source) : void {
$this->violations = array_merge($this->violations, $source
->getViolations());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Response:: |
protected | property | List of violations. | |
Response:: |
public | function |
Adds the violation. Overrides ResponseInterface:: |
|
Response:: |
public | function |
Adds multiple violations. Overrides ResponseInterface:: |
|
Response:: |
public | function |
Gets the violations. Overrides ResponseInterface:: |
|
Response:: |
public | function |
Adds the violations from another response to this response. Overrides ResponseInterface:: |