SilverStripe\GraphQL\Scaffolding\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.
Synopsis
class StaticSchema
{
- // constants
- const PREFER_UNION = 1;
- const PREFER_SINGLE = 2;
- // members
- private static StaticSchema $instance;
- protected $typesMap;
- protected FieldAccessorInterface|null $fieldAccessor;
- protected callable $fieldFormatter;
- private static string $inheritanceTypeSuffix = 'WithDescendants';
- // methods
- public static StaticSchema inst()
- public static void setInstance()
- public static void reset()
- public $this load()
- public string typeNameForDataObject()
- public string inheritanceTypeNameForDataObject()
- public string inheritanceTypeNameForType()
- public mixed typeName()
- public bool isValidFieldName()
- public $this setTypeNames()
- public array getAncestry()
- public array getDescendants()
- public Type fetchFromManager()
- public array introspectTypes()
- public string formatField()
- public array formatFields()
- public array formatKeys()
- public array extractKeys()
- public FieldAccessorInterface|null getFieldAccessor()
- public mixed accessField()
- public $this setFieldAccessor()
- public callable getFieldFormatter()
- public $this setFieldFormatter()
- protected mixed|null mappedTypeName()
- protected void ensureDataObject()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
Constants
Name | Value |
---|---|
PREFER_UNION | 1 |
PREFER_SINGLE | 2 |
Members
private
- $inheritanceTypeSuffix — string
- $instance — SilverStripe\GraphQL\Scaffolding\StaticSchema
protected
- $fieldAccessor — SilverStripe\GraphQL\Scaffolding\FieldAccessorInterface|null
- $fieldFormatter — SilverStripe\GraphQL\Scaffolding\callable
- $typesMap — array
Methods
protected
public
- accessField()
- extractKeys() — Extracts the values for a list of keys
- fetchFromManager() — Gets the type from the manager given a DataObject class. Will use an inheritance type if available.
- formatField()
- formatFields()
- formatKeys() — Formats all the keys of an array, preserving the values
- getAncestry() — Gets all ancestors of a DataObject
- getDescendants()
- getFieldAccessor()
- getFieldFormatter()
- inheritanceTypeNameForDataObject() — Gets the type name for a union type of all ancestors of a class given the classname
- inheritanceTypeNameForType() — Gets the type name for a union type of all ancestors of a class given the type name
- inst()
- introspectTypes()
- isValidFieldName() — Returns true if the field name can be accessed on the given object
- load() — Boots the type names from config. No graphql request necessary.
- reset() — Removes the current instance
- setFieldAccessor()
- setFieldFormatter()
- setInstance()
- setTypeNames()
- typeName()
- typeNameForDataObject() — Given a DataObject subclass name, transform it into a sanitised (and implicitly unique) type name suitable for the GraphQL schema