You are here

protected function TypedDataTypeResolver::getPropertyResolverFunction in GraphQL 8

Same name and namespace in other branches
  1. 8.2 src/TypeResolver/TypedDataTypeResolver.php \Drupal\graphql\TypeResolver\TypedDataTypeResolver::getPropertyResolverFunction()

Helper function to find the proper resolver function for a given property.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $propertyDefinition: The property definition for which to return the resolver function.

Return value

callable|null The resolver function or NULL if none applies.

2 calls to TypedDataTypeResolver::getPropertyResolverFunction()
ContentEntityTypeResolver::resolveFieldFromProperty in src/TypeResolver/ContentEntityTypeResolver.php
Helper function to resolve a field definition from a typed data property.
TypedDataTypeResolver::resolveFieldFromProperty in src/TypeResolver/TypedDataTypeResolver.php
Helper function to resolve a field definition from a typed data property.

File

src/TypeResolver/TypedDataTypeResolver.php, line 204

Class

TypedDataTypeResolver
Generically resolves the schema for typed data types.

Namespace

Drupal\graphql\TypeResolver

Code

protected function getPropertyResolverFunction(DataDefinitionInterface $propertyDefinition) {
  if ($propertyDefinition instanceof ComplexDataDefinitionInterface) {
    return [
      __CLASS__,
      'getPropertyComplexValue',
    ];
  }
  if ($propertyDefinition instanceof ListDataDefinitionInterface) {
    return [
      __CLASS__,
      'getPropertyListValue',
    ];
  }
  if ($propertyDefinition instanceof DataReferenceDefinitionInterface) {
    return [
      __CLASS__,
      'getPropertyReferenceValue',
    ];
  }
  if ($propertyDefinition instanceof DataDefinitionInterface) {
    return [
      __CLASS__,
      'getPropertyPrimitiveValue',
    ];
  }
  return NULL;
}