StaticSchema
class StaticSchema (View source)
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
Constants
PREFER_UNION |
|
PREFER_SINGLE |
|
Properties
static private string | $inheritanceTypeSuffix |
Methods
No description
Removes the current instance
Boots the type names from config. No graphql request necessary.
Given a DataObject subclass name, transform it into a sanitised (and implicitly unique) type name suitable for the GraphQL schema
Gets the type name for a union type of all ancestors of a class given the classname
Gets the type name for a union type of all ancestors of a class given the type name
No description
Returns true if the field name can be accessed on the given object
No description
Gets all ancestors of a DataObject
No description
Gets the type from the manager given a DataObject class. Will use an inheritance type if available.
No description
Formats all the keys of an array, preserving the values
Extracts the values for a list of keys
No description
No description
No description
Details
static StaticSchema
inst()
static
setInstance(StaticSchema $inst = null)
static
reset()
Removes the current instance
StaticSchema
load(string $schemaName)
Boots the type names from config. No graphql request necessary.
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)
bool
isValidFieldName(ViewableData $instance, string $fieldName)
Returns true if the field name can be accessed on the given object
$this
setTypeNames(array $typesMap)
array
getAncestry(string $dataObjectClass)
Gets all ancestors of a DataObject
array
getDescendants(string $dataObjectClass)
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)
string
formatField(string $field)
array
formatKeys(array $arr)
Formats all the keys of an array, preserving the values
array
extractKeys(array $keys, array $arr, bool $graceful = true)
Extracts the values for a list of keys