class FieldItemTypeResolver in GraphQL 8.2
Same name and namespace in other branches
- 8 src/TypeResolver/FieldItemTypeResolver.php \Drupal\graphql\TypeResolver\FieldItemTypeResolver
Resolves the schema for field definitions.
Note: This resolver is only relevant for complex fields which can not be simplified via the content entity schema resolver.
Hierarchy
- class \Drupal\graphql\TypeResolver\TypedDataTypeResolver implements TypeResolverInterface
- class \Drupal\graphql\TypeResolver\FieldItemTypeResolver
Expanded class hierarchy of FieldItemTypeResolver
1 string reference to 'FieldItemTypeResolver'
1 service uses FieldItemTypeResolver
File
- src/
TypeResolver/ FieldItemTypeResolver.php, line 18
Namespace
Drupal\graphql\TypeResolverView source
class FieldItemTypeResolver extends TypedDataTypeResolver {
/**
* The typed data manager service.
*
* @var \Drupal\Core\TypedData\TypedDataManager
*/
protected $typedDataManager;
/**
* The entity manager service.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* Constructs a FieldItemTypeResolver object.
*
* @param TypeResolverInterface $typeResolver
* The base type resolver service.
* @param \Drupal\Core\Entity\EntityManagerInterface $entityManager
* The entity manager service.
*/
public function __construct(TypeResolverInterface $typeResolver, EntityManagerInterface $entityManager) {
parent::__construct($typeResolver);
$this->entityManager = $entityManager;
}
/**
* {@inheritdoc}
*/
public function applies($type) {
return $type instanceof FieldItemDataDefinition;
}
/**
* {@inheritdoc}
*/
protected function getTypeIdentifier(DataDefinitionInterface $type) {
/** @var FieldItemDataDefinition $type */
$fieldDefinition = $type
->getFieldDefinition();
$fieldName = $fieldDefinition
->getName();
$entityTypeId = $fieldDefinition
->getTargetEntityTypeId();
// Create a more specifc data type identifier because the one returned via
// typed data is too vague and does not contain information about the owning
// entity type.
return "field:item:{$entityTypeId}:{$fieldName}";
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FieldItemTypeResolver:: |
protected | property | The entity manager service. | |
FieldItemTypeResolver:: |
protected | property | The typed data manager service. | |
FieldItemTypeResolver:: |
public | function |
Overrides TypedDataTypeResolver:: |
|
FieldItemTypeResolver:: |
protected | function |
Retrieves the unique type identifier for a specific data type. Overrides TypedDataTypeResolver:: |
|
FieldItemTypeResolver:: |
public | function |
Constructs a FieldItemTypeResolver object. Overrides TypedDataTypeResolver:: |
|
TypedDataTypeResolver:: |
protected | property | Static cache of resolved complex data types. | |
TypedDataTypeResolver:: |
protected | property | Maps data types to primitive types. | |
TypedDataTypeResolver:: |
protected | property | The type resolver service. | |
TypedDataTypeResolver:: |
protected | function | ||
TypedDataTypeResolver:: |
public static | function | Property value resolver callback for complex properties | |
TypedDataTypeResolver:: |
public static | function | Property value resolver callback for list properties. | |
TypedDataTypeResolver:: |
public static | function | Property value resolver callback for primitive properties. | |
TypedDataTypeResolver:: |
public static | function | Property value resolver callback for reference properties. | |
TypedDataTypeResolver:: |
protected | function | Helper function to find the proper resolver function for a given property. | |
TypedDataTypeResolver:: |
protected | function | Helper function to resolve a field definition from a typed data property. | 1 |
TypedDataTypeResolver:: |
protected | function | Helper function to resolve the list of available fields for a type. | 1 |
TypedDataTypeResolver:: |
public | function |
Overrides TypeResolverInterface:: |
1 |
TypedDataTypeResolver:: |
protected | function | Resolves complex data definitions. | |
TypedDataTypeResolver:: |
protected | function | Resolves list data definitions. | |
TypedDataTypeResolver:: |
protected | function | Resolves primitive data definitions. | |
TypedDataTypeResolver:: |
protected | function | Resolves data reference definitions. |