EntityType.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Types/Entity/EntityType.php
View source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Types\Entity;
use Drupal\Core\Entity\EntityInterface;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Types\TypePluginBase;
use GraphQL\Type\Definition\ResolveInfo;
class EntityType extends TypePluginBase {
public function applies($object, ResolveContext $context, ResolveInfo $info) {
if ($object instanceof EntityInterface) {
$definition = $this
->getPluginDefinition();
return $object
->getEntityTypeId() === $definition['entity_type'];
}
return FALSE;
}
}
Classes
Name |
Description |
EntityType |
Plugin annotation
@GraphQLType(
id = "entity_type",
schema_cache_tags = {"entity_types"},
deriver = "Drupal\graphql_core\Plugin\Deriver\Types\EntityTypeDeriver"
) |