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 {@link 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 |
|
Properties
static private callable | $pluraliser |
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
No description
Converts a configuration array to instance state.
Creates a readonly object that can be used by a storage service.
No description
No description
No description
No description
No description
No description
No description
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
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Some types must be eagerly loaded into the schema if they cannot be discovered through introspection.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Pluralise a name
No description
No description
No description
Details
static Injectable
create(array ...$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'); $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)
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 {@link 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()
string
getSchemaKey()
SchemaConfig
getConfig()
Configuration
getState()
Schema
removeType(string $type)
Type|null
getType(string $name)
Type
findOrMakeType(string $name)
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()
Type
getQueryType()
Type
getMutationType()
Type|null
getTypeOrModel(string $name)
Schema
removeEnum(string $name)
array
getEnums()
Enum|null
getEnum(string $name)
array
getScalars()
Scalar|null
getScalar(string $name)
Schema
removeScalar(string $name)
ModelType|null
getModel(string $name)
Schema
addModelbyClassName(string $class, callable|null $callback = null)
Schema
removeModelByClassName(string $class)
Schema
removeModel(string $name)
ModelType|null
getModelByClassName(string $class)
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)
ModelType|null
createModel(string $class, array $config = [])
array
getModels()
ModelType
findOrMakeModel(string $class)
Schema
addInterface(InterfaceType $type, callable|null $callback = null)
Schema
removeInterface(string $name)
InterfaceType|null
getInterface(string $name)
array
getInterfaces()
array
getImplementorsOf(string $interfaceName)
Schema
removeUnion(string $name)
UnionType|null
getUnion(string $name)
array
getUnions()
Schema
applyBulkLoader(AbstractBulkLoader $loader, array $modelConfig)
Schema
applyBulkLoaders(BulkLoaderSet $loaders, array $modelConfig)
static array
getInternalTypes()
static bool
isInternalType(string $type)
string
pluralise(string $typeName)
Pluralise a name