ParentValue.php in GraphQL 8.4
Namespace
Drupal\graphql\GraphQL\ResolverFile
src/GraphQL/Resolver/ParentValue.phpView source
<?php
namespace Drupal\graphql\GraphQL\Resolver;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\graphql\GraphQL\Execution\FieldContext;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use GraphQL\Type\Definition\ResolveInfo;
/**
* Resolves to the current value, which is the parent of the field.
*/
class ParentValue implements ResolverInterface {
/**
* {@inheritdoc}
*/
public function resolve($value, $args, ResolveContext $context, ResolveInfo $info, FieldContext $field) {
if ($value instanceof CacheableDependencyInterface) {
$context
->addCacheableDependency($value);
}
return $value;
}
}
Classes
Name | Description |
---|---|
ParentValue | Resolves to the current value, which is the parent of the field. |