protected function TypedDataTypeResolver::getPrimitiveType in GraphQL 8.2
Same name and namespace in other branches
- 8 src/TypeResolver/TypedDataTypeResolver.php \Drupal\graphql\TypeResolver\TypedDataTypeResolver::getPrimitiveType()
Parameters
\Drupal\Core\TypedData\DataDefinitionInterface|string $type: The data definition for which to return the corresponding primitive type.
Return value
\Fubhy\GraphQL\Type\Definition\Types\TypeInterface|null The primitive type or NULL if the data type is not a primitive.
1 call to TypedDataTypeResolver::getPrimitiveType()
- TypedDataTypeResolver::resolveRecursivePrimitive in src/
TypeResolver/ TypedDataTypeResolver.php - Resolves primitive data definitions.
File
- src/
TypeResolver/ TypedDataTypeResolver.php, line 266
Class
- TypedDataTypeResolver
- Generically resolves the schema for typed data types.
Namespace
Drupal\graphql\TypeResolverCode
protected function getPrimitiveType(DataDefinitionInterface $type) {
if (!isset($this->primiviteMap)) {
$this->primiviteMap = [
'integer' => Type::intType(),
'string' => Type::stringType(),
'boolean' => Type::booleanType(),
'float' => Type::floatType(),
'email' => Type::stringType(),
'timestamp' => Type::intType(),
'uri' => Type::stringType(),
];
}
if (($dataType = $this
->getTypeIdentifier($type)) && isset($this->primiviteMap[$dataType])) {
return $this->primiviteMap[$dataType];
}
return NULL;
}