class StaticSchema

Global map of dataobject classes to graphql schema types.

Provides an automatic scaffold mechanism for any classes without explicit mapping.

This must be done globally and prior to scaffolding as type mapping must be determined before scaffolding begins.

Traits

Provides extensions to this object to integrate it with standard config API methods.

Constants

PREFER_UNION

PREFER_SINGLE

Config options

inheritanceTypeSuffix string

Methods

static Config_ForClass
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .

mixed
stat(string $name) deprecated

Get inherited config value

mixed
uninherited(string $name)

Gets the uninherited value for the given config option

$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

static StaticSchema
inst()

No description

static 
setInstance(StaticSchema $inst = null)

No description

static 
reset()

Removes the current instance

string
typeNameForDataObject(string $class)

Given a DataObject subclass name, transform it into a sanitised (and implicitly unique) type name suitable for the GraphQL schema

string
inheritanceTypeNameForDataObject(string $class)

Gets the type name for a union type of all ancestors of a class given the classname

string
inheritanceTypeNameForType(string $typeName)

Gets the type name for a union type of all ancestors of a class given the type name

mixed
typeName(string $str)

No description

bool
isValidFieldName(ViewableData $instance, string $fieldName)

Returns true if the field name can be accessed on the given object

$this
setTypeNames(array $typesMap)

No description

array
getAncestry(string $dataObjectClass)

Gets all ancestors of a DataObject

array
getDescendants(string $dataObjectClass)

No description

Type
fetchFromManager(string $class, Manager $manager, int $mode = self::PREFER_UNION)

Gets the type from the manager given a DataObject class. Will use an inheritance type if available.

array
introspectTypes(Manager $manager)

No description

Details

in Configurable at line 20
static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .

....).

Return Value

Config_ForClass

in Configurable at line 32
mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

in Configurable at line 44
mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

in Configurable at line 57
$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

at line 51
static StaticSchema inst()

Return Value

StaticSchema

at line 63
static setInstance(StaticSchema $inst = null)

Parameters

StaticSchema $inst

at line 71
static reset()

Removes the current instance

at line 83
string typeNameForDataObject(string $class)

Given a DataObject subclass name, transform it into a sanitised (and implicitly unique) type name suitable for the GraphQL schema

Parameters

string $class

Return Value

string

at line 101
string inheritanceTypeNameForDataObject(string $class)

Gets the type name for a union type of all ancestors of a class given the classname

Parameters

string $class

Return Value

string

at line 112
string inheritanceTypeNameForType(string $typeName)

Gets the type name for a union type of all ancestors of a class given the type name

Parameters

string $typeName

Return Value

string

at line 121
mixed typeName(string $str)

Parameters

string $str

Return Value

mixed

at line 133
bool isValidFieldName(ViewableData $instance, string $fieldName)

Returns true if the field name can be accessed on the given object

Parameters

ViewableData $instance
string $fieldName

Return Value

bool

at line 142
$this setTypeNames(array $typesMap)

Parameters

array $typesMap An associate array of classname => type name

Return Value

$this

at line 180
array getAncestry(string $dataObjectClass)

Gets all ancestors of a DataObject

Parameters

string $dataObjectClass

Return Value

array

at line 203
array getDescendants(string $dataObjectClass)

Parameters

string $dataObjectClass

Return Value

array

Exceptions

InvalidArgumentException

at line 227
Type fetchFromManager(string $class, Manager $manager, int $mode = self::PREFER_UNION)

Gets the type from the manager given a DataObject class. Will use an inheritance type if available.

Parameters

string $class
Manager $manager
int $mode

Return Value

Type

at line 260
array introspectTypes(Manager $manager)

Parameters

Manager $manager

Return Value

array

Exceptions

Exception