You are here

class SchemaExtension in GraphQL 8.4

Annotation for GraphQL schema extension plugins.

@codeCoverageIgnore

Hierarchy

Expanded class hierarchy of SchemaExtension

1 string reference to 'SchemaExtension'
graphql.services.yml in ./graphql.services.yml
graphql.services.yml
2 classes are annotated with SchemaExtension
ComposableSchemaExampleExtension in examples/graphql_composable/src/Plugin/GraphQL/SchemaExtension/ComposableSchemaExampleExtension.php
Plugin annotation @SchemaExtension( id = "composable_extension", name = "Composable Example extension", description = "A simple extension that adds node related fields.", schema = "composable" )
ExampleSchemaExtension in examples/graphql_example/src/Plugin/GraphQL/SchemaExtension/ExampleSchemaExtension.php
Plugin annotation @SchemaExtension( id = "example_extension", name = "Example extension", description = "A simple extension that adds node related fields.", schema = "example" )

File

src/Annotation/SchemaExtension.php, line 14

Namespace

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

  /**
   * The plugin ID.
   *
   * @var string
   */
  public $id;

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

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

  /**
   * The id of the schema plugin to extend.
   *
   * @var string
   */
  public $schema;

  /**
   * SchemaExtension 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('The plugin is missing an "id" property.');
    }
    parent::__construct($values);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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
SchemaExtension::$description public property The plugin description.
SchemaExtension::$id public property The plugin ID.
SchemaExtension::$name public property The plugin name.
SchemaExtension::$schema public property The id of the schema plugin to extend.
SchemaExtension::__construct public function SchemaExtension constructor. Overrides Plugin::__construct