protected function EntityQuery::getCacheDependencies in GraphQL 8.3
Retrieve the list of cache dependencies for a given value and arguments.
Parameters
array $result: The result of the field.
mixed $parent: The parent value.
array $args: The arguments passed to the field.
\Drupal\graphql\GraphQL\Execution\ResolveContext $context: The resolve context.
\GraphQL\Type\Definition\ResolveInfo $info: The resolve info object.
Return value
array A list of cacheable dependencies.
Overrides FieldPluginBase::getCacheDependencies
File
- modules/
graphql_core/ src/ Plugin/ GraphQL/ Fields/ EntityQuery/ EntityQuery.php, line 87
Class
- EntityQuery
- @GraphQLField( id = "entity_query", secure = false, type = "EntityQueryResult", arguments = { "filter" = "EntityQueryFilterInput", "sort" = "[EntityQuerySortInput]", "offset" =…
Namespace
Drupal\graphql_core\Plugin\GraphQL\Fields\EntityQueryCode
protected function getCacheDependencies(array $result, $value, array $args, ResolveContext $context, ResolveInfo $info) {
$entityType = $this
->getEntityType($value, $args, $context, $info);
$type = $this->entityTypeManager
->getDefinition($entityType);
$metadata = new CacheableMetadata();
$metadata
->addCacheTags($type
->getListCacheTags());
$metadata
->addCacheContexts($type
->getListCacheContexts());
return [
$metadata,
];
}