Manager
class Manager implements ConfigurationApplier (View source)
Manager is the master container for a graphql endpoint, and contains all queries, mutations, and types.
Instantiate with {see \SilverStripe\GraphQL\Manager::createFromConfig()} with a config array.
Traits
Constants
QUERY_ROOT |
|
MUTATION_ROOT |
|
TYPES_ROOT |
|
Methods
No description
No description
No description
Build the main Schema instance that represents the final schema for this endpoint
Execute an arbitrary operation (mutation / query) on this schema.
Evaluate query via middleware
Register a new type
Return a type definition by name
No description
Get a query by name
Register a new mutation. Mutations can be callbacks to ensure dependent types are lazy-loaded.
Get a mutation by name
No description
No description
More verbose error display defaults.
Set the Member for the current context
Get the Member for the current context either from a previously set value or the current user
get query from persisted id, return null if not found
No description
Serialise a Graphql result object for output
Details
QueryMiddleware[]
getMiddlewares()
$this
setMiddlewares(QueryMiddleware[] $middlewares)
$this
addMiddleware(QueryMiddleware $middleware)
__construct(string $schemaKey = null)
static Manager
createFromConfig($config, string $schemaKey = null)
deprecated
deprecated
Manager
configure()
Applies a configuration based on the schemaKey property
applyConfig(array $config)
Schema
schema()
Build the main Schema instance that represents the final schema for this endpoint
array
query(string $query, array $params = [])
Execute an arbitrary operation (mutation / query) on this schema.
Note because middleware may produce serialised responses we need to conditionally normalise to serialised array on output from object -> array.
ExecutionResult|array
queryAndReturnResult(string $query, array $params = [])
Evaluate query via middleware
addType(Type $type, string $name = '')
Register a new type
Type
getType(string $name)
Return a type definition by name
bool
hasType(string $name)
addQuery(array|Closure $query, string $name)
Register a new Query. Query can be defined as a closure to ensure dependent types are lazy loaded.
array
getQuery(string $name)
Get a query by name
addMutation(array|Closure $mutation, string $name)
Register a new mutation. Mutations can be callbacks to ensure dependent types are lazy-loaded.
array
getMutation(string $name)
Get a mutation by name
string
getSchemaKey()
$this
setSchemaKey(string $schemaKey)
static array
formatError(Error $exception)
More verbose error display defaults.
$this
setMember(Member $member)
Set the Member for the current context
Member
getMember()
Get the Member for the current context either from a previously set value or the current user
string
getQueryFromPersistedID($id)
get query from persisted id, return null if not found
$this
addContext(string $key, any $value)
array
serialiseResult(ExecutionResult $executionResult)
Serialise a Graphql result object for output