class Controller extends Controller implements Flushable (View source)

Top level controller for handling graphql requests.

Constants

CACHE_FILENAME

Properties

static private array $cors

Cors default config

static private bool $cache_types_in_filesystem

If true, store the fragment JSON in a flat file in assets/

static private bool $cache_on_flush

Toggles caching types to the file system on flush This is set to false in test state see DisableTypeCacheState

Methods

__construct(Manager $manager = null)

No description

HTTPResponse
index(HTTPRequest $request)

Handles requests to the index action (e.g. /graphql)

getManager(HTTPRequest $request = null)

No description

$this
setManager(Manager $manager)

No description

$this
setAssetHandler(GeneratedAssetHandler $handler)

No description

GeneratedAssetHandler
getAssetHandler()

No description

getAuthHandler()

Get an instance of the authorization Handler to manage any authentication requirements

string
getToken()

No description

HTTPResponse
addCorsHeaders(HTTPRequest $request, HTTPResponse $response)

Process the CORS config options and add the appropriate headers to the response.

array
getCorsConfig()

No description

array
getMergedCorsConfig()

No description

setCorsConfig(array $config)

No description

writeSchemaToFilesystem()

Introspect the schema and persist it to the filesystem

removeSchemaFromFilesystem()

No description

writeTypes(string $content)

No description

processTypeCaching()

Write the types json to a flat file, if silverstripe/assets is available

static 
flush()

No description

Details

__construct(Manager $manager = null)

Parameters

Manager $manager

HTTPResponse index(HTTPRequest $request)

Handles requests to the index action (e.g. /graphql)

Parameters

HTTPRequest $request

Return Value

HTTPResponse

Manager getManager(HTTPRequest $request = null)

Parameters

HTTPRequest $request

Return Value

Manager

$this setManager(Manager $manager)

Parameters

Manager $manager

Return Value

$this

$this setAssetHandler(GeneratedAssetHandler $handler)

Parameters

GeneratedAssetHandler $handler

Return Value

$this

GeneratedAssetHandler getAssetHandler()

Return Value

GeneratedAssetHandler

Handler getAuthHandler()

Get an instance of the authorization Handler to manage any authentication requirements

Return Value

Handler

string getToken()

Return Value

string

HTTPResponse addCorsHeaders(HTTPRequest $request, HTTPResponse $response)

Process the CORS config options and add the appropriate headers to the response.

Parameters

HTTPRequest $request
HTTPResponse $response

Return Value

HTTPResponse

array getCorsConfig()

Return Value

array

array getMergedCorsConfig()

Return Value

array

Controller setCorsConfig(array $config)

Parameters

array $config

Return Value

Controller

writeSchemaToFilesystem()

Introspect the schema and persist it to the filesystem

Exceptions

Exception

removeSchemaFromFilesystem()

writeTypes(string $content)

Parameters

string $content

processTypeCaching()

Write the types json to a flat file, if silverstripe/assets is available

static flush()