class Type implements ConfigurationApplier, SchemaValidator, SignatureProvider, SchemaComponent (View source)

Abstraction for a generic type

Traits

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

A class that can be instantiated or replaced via DI

Allows adding, loading, and sorting of plugins

Properties

protected Field[] $fields

Methods

public static 
config()

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

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public static 
create(mixed ...$args)

An implementation of the factory method, allows you to create an instance of a class

public static 
singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

public
addPlugin(string $pluginName, array $config = [])

No description

public
removePlugin(string $pluginName)

No description

public
mergePlugins(array $plugins)

No description

public
setPlugins(array $plugins)

No description

public
setDefaultPlugins(array $plugins)

No description

public
array
getPlugins(bool $inheritDefaults = true)

No description

public
array
getDefaultPlugins()

No description

public
bool
hasPlugin(string $identifier)

No description

public
getPluginRegistry()

No description

public
loadPlugins()

Translates all the ID and config settings to first class instances

public
array
getSortedPlugins()

Sorts the before/after of plugins using topological sort

public
__construct(string $name, array|null $config = null)

No description

public
mixed
applyConfig(array $config)

No description

public
string|null
getName()

No description

public
setName(string $name)

No description

public
array
getFields()

No description

public
setFields(array $fields)

No description

public
addField(string $fieldName, string|array|Field $fieldConfig, callable|null $callback = null)

No description

public
removeField(string $field)

No description

public
Field|null
getFieldByName(string $fieldName)

No description

public
string|null
getDescription()

No description

public
mergeWith(Type $type)

No description

public
void
validate()

No description

public
bool
exists()

No description

public
setDescription(string|null $description)

No description

public
array
getInterfaces()

No description

public
string
getEncodedInterfaces()

No description

public
setInterfaces(array $interfaces)

No description

public
addInterface(string $name)

No description

public
bool
implements(string $interfaceName)

No description

public
bool
getIsInput()

No description

public
setIsInput(bool $isInput)

No description

public
ResolverReference|null
getFieldResolver()

No description

public
setFieldResolver(array|string|ResolverReference|null $fieldResolver)

No description

public
string
getSignature()

A deterministic representation of everything that gets encoded into the template.

Details

static Config_ForClass config()

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

Return Value

Config_ForClass

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

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();

Parameters

mixed ...$args

Return Value

Injectable

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).

Parameters

string $class

Optional classname to create, if the called class should not be used

Return Value

Injectable

The singleton instance

PluginConsumer addPlugin(string $pluginName, array $config = [])

No description

Parameters

string $pluginName
array $config

Return Value

PluginConsumer

PluginConsumer removePlugin(string $pluginName)

No description

Parameters

string $pluginName

Return Value

PluginConsumer

PluginConsumer mergePlugins(array $plugins)

No description

Parameters

array $plugins

Return Value

PluginConsumer

PluginConsumer setPlugins(array $plugins)

No description

Parameters

array $plugins

Return Value

PluginConsumer

Exceptions

SchemaBuilderException

PluginConsumer setDefaultPlugins(array $plugins)

No description

Parameters

array $plugins

Return Value

PluginConsumer

Exceptions

SchemaBuilderException

array getPlugins(bool $inheritDefaults = true)

No description

Parameters

bool $inheritDefaults

Return Value

array

array getDefaultPlugins()

No description

Return Value

array

bool hasPlugin(string $identifier)

No description

Parameters

string $identifier

Return Value

bool

PluginRegistry getPluginRegistry()

No description

Return Value

PluginRegistry

Generator loadPlugins()

Translates all the ID and config settings to first class instances

Return Value

Generator

Exceptions

SchemaBuilderException
CircularDependencyException
ElementNotFoundException

array getSortedPlugins()

Sorts the before/after of plugins using topological sort

Return Value

array

Exceptions

CircularDependencyException
ElementNotFoundException

__construct(string $name, array|null $config = null)

No description

Parameters

string $name
array|null $config

Exceptions

SchemaBuilderException

mixed applyConfig(array $config)

No description

Parameters

array $config

Return Value

mixed

Exceptions

SchemaBuilderException

string|null getName()

No description

Return Value

string|null

Type setName(string $name)

No description

Parameters

string $name

Return Value

Type

array getFields()

No description

Return Value

array

Type setFields(array $fields)

No description

Parameters

array $fields

Return Value

Type

Exceptions

SchemaBuilderException

Type addField(string $fieldName, string|array|Field $fieldConfig, callable|null $callback = null)

No description

Parameters

string $fieldName
string|array|Field $fieldConfig
callable|null $callback

Return Value

Type

Type removeField(string $field)

No description

Parameters

string $field

Return Value

Type

Field|null getFieldByName(string $fieldName)

No description

Parameters

string $fieldName

Return Value

Field|null

string|null getDescription()

No description

Return Value

string|null

Type mergeWith(Type $type)

No description

Parameters

Type $type

Return Value

Type

Exceptions

SchemaBuilderException

void validate()

No description

Return Value

void

Exceptions

SchemaBuilderException

bool exists()

No description

Return Value

bool

setDescription(string|null $description)

No description

Parameters

string|null $description

array getInterfaces()

No description

Return Value

array

string getEncodedInterfaces()

No description

Return Value

string

Type setInterfaces(array $interfaces)

No description

Parameters

array $interfaces

Return Value

Type

Type addInterface(string $name)

No description

Parameters

string $name

Return Value

Type

bool implements(string $interfaceName)

No description

Parameters

string $interfaceName

Return Value

bool

bool getIsInput()

No description

Return Value

bool

Type setIsInput(bool $isInput)

No description

Parameters

bool $isInput

Return Value

Type

ResolverReference|null getFieldResolver()

No description

Return Value

ResolverReference|null

Type setFieldResolver(array|string|ResolverReference|null $fieldResolver)

No description

Parameters

array|string|ResolverReference|null $fieldResolver

Return Value

Type

string getSignature()

A deterministic representation of everything that gets encoded into the template.

Used as a cache key. This method will need to be updated if new data is added to the generated code.

Return Value

string

Exceptions

Exception