You are here

abstract class GraphQLAnnotationBase in GraphQL 8.3

Annotation for GraphQL input type plugins.

Hierarchy

Expanded class hierarchy of GraphQLAnnotationBase

File

src/Annotation/GraphQLAnnotationBase.php, line 14

Namespace

Drupal\graphql\Annotation
View source
abstract class GraphQLAnnotationBase extends Plugin {

  /**
   * The plugin type.
   *
   * The type of component. Field, Interface, Type, Scalar ...
   *
   * @var string
   *
   * @see graphql.module
   */
  public $pluginType = NULL;

  /**
   * The component name.
   *
   * @var string
   */
  public $name;

  /**
   * The component description.
   *
   * @var string
   */
  public $description = '';

  /**
   * Weight for precedence calculations.
   *
   * If multiple components with the same name are available, the highest
   * weight wins.
   *
   * @var int
   */
  public $weight = 0;

  /**
   * The cache contexts for caching the type system definition in the schema.
   *
   * @var array
   */
  public $schema_cache_contexts = [];

  /**
   * The cache tags for caching the type system definition in the schema.
   *
   * @var array
   */
  public $schema_cache_tags = [];

  /**
   * The cache max age for caching the type system definition in the schema.
   *
   * @var array
   */
  public $schema_cache_max_age = CacheBackendInterface::CACHE_PERMANENT;

  /**
   * The cache contexts for caching the response.
   *
   * @var array
   */
  public $response_cache_contexts = [
    'user.permissions',
  ];

  /**
   * The cache tags for caching the response.
   *
   * @var array
   */
  public $response_cache_tags = [];

  /**
   * The cache max age for caching the response.
   *
   * @var array
   */
  public $response_cache_max_age = CacheBackendInterface::CACHE_PERMANENT;

  /**
   * GraphQLAnnotationBase constructor.
   *
   * @param $values
   *   The plugin annotation values.
   *
   * @throws \Doctrine\Common\Annotations\AnnotationException
   *   In case of missing required annotation values.
   */
  public function __construct($values) {
    if (!array_key_exists('id', $values) || !$values['id']) {
      throw new AnnotationException('GraphQL plugin is missing an "id" property.');
    }
    parent::__construct($values);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GraphQLAnnotationBase::$description public property The component description.
GraphQLAnnotationBase::$name public property The component name.
GraphQLAnnotationBase::$pluginType public property The plugin type. 9
GraphQLAnnotationBase::$response_cache_contexts public property The cache contexts for caching the response.
GraphQLAnnotationBase::$response_cache_max_age public property The cache max age for caching the response.
GraphQLAnnotationBase::$response_cache_tags public property The cache tags for caching the response.
GraphQLAnnotationBase::$schema_cache_contexts public property The cache contexts for caching the type system definition in the schema.
GraphQLAnnotationBase::$schema_cache_max_age public property The cache max age for caching the type system definition in the schema.
GraphQLAnnotationBase::$schema_cache_tags public property The cache tags for caching the type system definition in the schema.
GraphQLAnnotationBase::$weight public property Weight for precedence calculations.
GraphQLAnnotationBase::__construct public function GraphQLAnnotationBase constructor. Overrides Plugin::__construct
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get 5
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider