EntityUuid.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Fields/Entity/EntityUuid.phpView source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Fields\Entity;
use Drupal\Core\Entity\EntityInterface;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use GraphQL\Type\Definition\ResolveInfo;
/**
* @GraphQLField(
* id = "entity_uuid",
* secure = true,
* name = "entityUuid",
* type = "String",
* parents = {"Entity"}
* )
*/
class EntityUuid extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if ($value instanceof EntityInterface) {
(yield $value
->uuid());
}
}
}
Classes
Name | Description |
---|---|
EntityUuid | Plugin annotation @GraphQLField( id = "entity_uuid", secure = true, name = "entityUuid", type = "String", parents = {"Entity"} ) |