EntityRevisions.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Fields/Entity/EntityRevisions.php
View source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Fields\Entity;
use Drupal\Core\Entity\EntityInterface;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql_core\Plugin\GraphQL\Fields\EntityQuery\EntityQuery;
use Drupal\graphql_core\Plugin\GraphQL\Interfaces\Entity\EntityRevisionable;
use GraphQL\Type\Definition\ResolveInfo;
class EntityRevisions extends EntityQuery {
public function getBaseQuery($value, array $args, ResolveContext $context, ResolveInfo $info) {
if ($value instanceof EntityInterface) {
$query = parent::getBaseQuery($value, $args, $context, $info);
$key = $value
->getEntityType()
->getKey('id');
$query
->condition($key, $value
->id());
return $this
->applyRevisionsMode($query, 'all');
}
}
}
Classes
Name |
Description |
EntityRevisions |
Plugin annotation
@GraphQLField(
id = "entity_revisions",
name = "entityRevisions",
secure = true,
parents = {"EntityRevisionable"},
type = "EntityQueryResult!",
arguments = {
"filter" = "EntityQueryFilterInput",
"sort" =… |