Schema
class Schema implements ConfigurationApplier (View source)
The main Schema definition. A docking station for all type, model and interface abstractions.
Applies plugins, validates, and persists to code.
Use SchemaBuilder to create functional instances of this type based on YAML configuration.
Traits
A class that can be instantiated or replaced via DI
Provides extensions to this object to integrate it with standard config API methods.
Constants
SCHEMA_CONFIG |
|
SOURCE |
|
TYPES |
|
QUERIES |
|
MUTATIONS |
|
BULK_LOAD |
|
MODELS |
|
INTERFACES |
|
UNIONS |
|
ENUMS |
|
SCALARS |
|
QUERY_TYPE |
|
MUTATION_TYPE |
|
ALL |
|
Config options
pluraliser | callable | ||
verbose | bool |
Properties
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Creates a readonly object that can be used by a storage service.
Given a type name, try to resolve it to any model-implementing component
Gets all the models that were generated from a given ancestor, e.g. DataObject
Some types must be eagerly loaded into the schema if they cannot be discovered through introspection.
No description
Details
static Injectable
create(mixed ...$args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create(SiteTree::class); $list = SiteTree::get();
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
stat(string $name)
deprecated
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
deprecated
Update the config value for a given property
__construct(string $schemaKey, SchemaConfig|null $schemaConfig = null)
No description
mixed
applyConfig(array $schemaConfig)
Converts a configuration array to instance state.
This is only needed for deeper customisations, since the configuration is auto-discovered and applied through the SchemaBuilder::boot() step.
StorableSchema
createStoreableSchema()
Creates a readonly object that can be used by a storage service.
Processes all of the types, fields, models, etc to end up with a coherent, schema that can be validated and stored.
bool
exists()
No description
string
getSchemaKey()
No description
SchemaConfig
getConfig()
No description
Configuration
getState()
No description
Schema
removeType(string $type)
No description
Type|null
getType(string $name)
No description
Type
findOrMakeType(string $name)
No description
Type|null
getCanonicalType(string $typeName)
Given a type name, try to resolve it to any model-implementing component
array
getModelTypesFromClass(string $class)
Gets all the models that were generated from a given ancestor, e.g. DataObject
array
getTypes()
No description
Type
getQueryType()
No description
Type
getMutationType()
No description
Type|null
getTypeOrModel(string $name)
No description
Schema
removeEnum(string $name)
No description
array
getEnums()
No description
Enum|null
getEnum(string $name)
No description
array
getScalars()
No description
Scalar|null
getScalar(string $name)
No description
Schema
removeScalar(string $name)
No description
ModelType|null
getModel(string $name)
No description
Schema
addModelbyClassName(string $class, callable|null $callback = null)
No description
Schema
removeModelByClassName(string $class)
No description
Schema
removeModel(string $name)
No description
ModelType|null
getModelByClassName(string $class)
No description
Schema
eagerLoad(string $name)
Some types must be eagerly loaded into the schema if they cannot be discovered through introspection.
This may include types that do not appear in any queries.
Schema
lazyLoad(string $name)
No description
ModelType|null
createModel(string $class, array $config = [])
No description
array
getModels()
No description
ModelType
findOrMakeModel(string $class)
No description
Schema
addInterface(InterfaceType $type, callable|null $callback = null)
No description
Schema
removeInterface(string $name)
No description
InterfaceType|null
getInterface(string $name)
No description
array
getInterfaces()
No description
array
getImplementorsOf(string $interfaceName)
No description
Schema
removeUnion(string $name)
No description
UnionType|null
getUnion(string $name)
No description
array
getUnions()
No description
Schema
applyBulkLoader(AbstractBulkLoader $loader, array $modelConfig)
No description
Schema
applyBulkLoaders(BulkLoaderSet $loaders, array $modelConfig)
No description
static array
getInternalTypes()
No description
static bool
isInternalType(string $type)
No description
string
pluralise(string $typeName)
Pluralise a name
static void
assertValidConfig(array $config, $allowedKeys = [], $requiredKeys = [])
No description
static void
assertValidName(string|null $name)
No description
static void
invariant($test, string $message = '', mixed ...$params)
No description