EntityCrudOutputErrors.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Fields/Mutations/EntityCrudOutputErrors.phpView source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Fields\Mutations;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql_core\GraphQL\EntityCrudOutputWrapper;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use GraphQL\Type\Definition\ResolveInfo;
/**
* Retrieve a list of error messages.
*
* @GraphQLField(
* id = "entity_crud_output_errors",
* secure = true,
* name = "errors",
* type = "[String]",
* parents = {"EntityCrudOutput"}
* )
*/
class EntityCrudOutputErrors extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if ($value instanceof EntityCrudOutputWrapper) {
if ($errors = $value
->getErrors()) {
foreach ($errors as $error) {
(yield $error);
}
}
}
}
}
Classes
Name![]() |
Description |
---|---|
EntityCrudOutputErrors | Retrieve a list of error messages. |