protected function TypedDataTypeResolver::resolveFieldFromProperty in GraphQL 8
Same name and namespace in other branches
- 8.2 src/TypeResolver/TypedDataTypeResolver.php \Drupal\graphql\TypeResolver\TypedDataTypeResolver::resolveFieldFromProperty()
Helper function to resolve a field definition from a typed data property.
Parameters
string $propertyKey: The key of the typed data property.
\Drupal\Core\TypedData\DataDefinitionInterface $propertyDefinition: The data definition of the property.
Return value
array|null The resolved field definition.
2 calls to TypedDataTypeResolver::resolveFieldFromProperty()
- ContentEntityTypeResolver::resolveFieldFromProperty in src/
TypeResolver/ ContentEntityTypeResolver.php - Helper function to resolve a field definition from a typed data property.
- TypedDataTypeResolver::resolveFields in src/
TypeResolver/ TypedDataTypeResolver.php - Helper function to resolve the list of available fields for a type.
1 method overrides TypedDataTypeResolver::resolveFieldFromProperty()
- ContentEntityTypeResolver::resolveFieldFromProperty in src/
TypeResolver/ ContentEntityTypeResolver.php - Helper function to resolve a field definition from a typed data property.
File
- src/
TypeResolver/ TypedDataTypeResolver.php, line 176
Class
- TypedDataTypeResolver
- Generically resolves the schema for typed data types.
Namespace
Drupal\graphql\TypeResolverCode
protected function resolveFieldFromProperty($propertyKey, DataDefinitionInterface $propertyDefinition) {
if (!($propertyType = $this->typeResolver
->resolveRecursive($propertyDefinition))) {
return NULL;
}
$isList = $propertyDefinition
->isList();
$isRequired = $propertyDefinition
->isRequired();
$propertyType = $isList ? new ListModifier($propertyType) : $propertyType;
$propertyType = $isRequired ? new NonNullModifier($propertyType) : $propertyType;
$resolverFunction = $this
->getPropertyResolverFunction($propertyDefinition);
return [
'type' => $propertyType,
'resolve' => $resolverFunction,
'resolveData' => [
'property' => $propertyKey,
],
];
}