You are here

class GraphQLSchema in GraphQL 8.3

Annotation for GraphQL schema plugins.

Hierarchy

Expanded class hierarchy of GraphQLSchema

1 string reference to 'GraphQLSchema'
graphql.services.yml in ./graphql.services.yml
graphql.services.yml
2 classes are annotated with GraphQLSchema
DefaultSchema in modules/graphql_core/src/Plugin/GraphQL/Schemas/DefaultSchema.php
Default generated schema.
TestSchema in tests/modules/graphql_test/src/Plugin/GraphQL/Schemas/TestSchema.php
Default generated schema.

File

src/Annotation/GraphQLSchema.php, line 12

Namespace

Drupal\graphql\Annotation
View source
class GraphQLSchema extends Plugin {

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

  /**
   * The schema path.
   *
   * @var string
   */
  public $path;

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

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

}

Members

Namesort descending Modifiers Type Description Overrides
GraphQLSchema::$name public property The schema name.
GraphQLSchema::$path public property The schema path.
GraphQLSchema::$weight public property Weight for precedence calculations.
GraphQLSchema::__construct public function GraphQLSchema 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