SilverStripe\GraphQL\Manager
Manager is the master container for a graphql endpoint, and contains all queries, mutations, and types.
Instantiate with with a config array.
Synopsis
class Manager
implements
ConfigurationApplier
{
- // constants
- const QUERY_ROOT = 'query';
- const MUTATION_ROOT = 'mutation';
- const TYPES_ROOT = 'types';
- // members
- protected $schemaKey;
- protected array $types = ;
- protected array $queries = ;
- protected array $mutations = ;
- protected callable $errorFormatter = ;
- protected Member $member;
- protected array $middlewares = ;
- protected array $extraContext = ;
- // methods
- public array getMiddlewares()
- public $this setMiddlewares()
- public $this addMiddleware()
- protected ExecutionResult|array callMiddleware()
- public void __construct()
- public static Manager createFromConfig()
- public Manager configure()
- public Manager applyConfig()
- public Schema schema()
- public array query()
- public ExecutionResult|array queryAndReturnResult()
- public void addType()
- public Type getType()
- public boolean hasType()
- public void addQuery()
- public array getQuery()
- public void addMutation()
- public array getMutation()
- public string getSchemaKey()
- public $this setSchemaKey()
- public static array formatError()
- public $this setMember()
- public Member getMember()
- public string getQueryFromPersistedID()
- protected array getContext()
- protected array getContextDefaults()
- public $this addContext()
- public array serialiseResult()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
- SilverStripe\Core\Extensible
- SilverStripe\Core\Config\Configurable
Implements
Constants
Name | Value |
---|---|
QUERY_ROOT | 'query' |
MUTATION_ROOT | 'mutation' |
TYPES_ROOT | 'types' |
Members
protected
- $errorFormatter — SilverStripe\GraphQL\callable
- $extraContext — array
- $member — SilverStripe\Security\Member
- $middlewares — array
- $mutations — array
- $queries — array
- $schemaKey — string
- $types
—
array
Map of named {@link Type}
Methods
protected
- callMiddleware() — Call middleware to evaluate a graphql query
- getContext() — Get global context to pass to $context for all queries
- getContextDefaults()
public
- __construct()
- addContext()
- addMiddleware()
- addMutation() — Register a new mutation. Mutations can be callbacks to ensure dependent types are lazy-loaded.
- addQuery() — Register a new Query. Query can be defined as a closure to ensure dependent types are lazy loaded.
- addType() — Register a new type
- applyConfig()
- configure() — Applies a configuration based on the schemaKey property
- createFromConfig()
- formatError() — More verbose error display defaults.
- getMember() — Get the Member for the current context either from a previously set value or the current user
- getMiddlewares()
- getMutation() — Get a mutation by name
- getQuery() — Get a query by name
- getQueryFromPersistedID() — get query from persisted id, return null if not found
- getSchemaKey()
- getType() — Return a type definition by name
- hasType()
- query() — Execute an arbitrary operation (mutation / query) on this schema.
- queryAndReturnResult() — Evaluate query via middleware
- schema() — Build the main Schema instance that represents the final schema for this endpoint
- serialiseResult() — Serialise a Graphql result object for output
- setMember() — Set the Member for the current context
- setMiddlewares()
- setSchemaKey()