You are here

class Value in GraphQL 8.4

Resolves by returning the fixed value itself.

Hierarchy

Expanded class hierarchy of Value

2 files declare their use of Value
MockingTrait.php in tests/src/Traits/MockingTrait.php
ResolverBuilder.php in src/GraphQL/ResolverBuilder.php

File

src/GraphQL/Resolver/Value.php, line 13

Namespace

Drupal\graphql\GraphQL\Resolver
View source
class Value implements ResolverInterface {

  /**
   * Value to be resolved.
   *
   * @var mixed
   */
  protected $value;

  /**
   * Value constructor.
   *
   * @param mixed $value
   */
  public function __construct($value) {
    $this->value = $value;
  }

  /**
   * {@inheritdoc}
   */
  public function resolve($value, $args, ResolveContext $context, ResolveInfo $info, FieldContext $field) {
    if ($this->value instanceof CacheableDependencyInterface) {
      $context
        ->addCacheableDependency($this->value);
    }
    return $this->value;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Value::$value protected property Value to be resolved.
Value::resolve public function Resolve values for the fields. Overrides ResolverInterface::resolve
Value::__construct public function Value constructor.