class InterfaceType extends Type (View source)

Defines a GraphQL interface. It may seem counter-intuitive that an abstraction would inherit from the concretion, but since these are just value objects that end up getting rendered as code, an unconventional architecture is probably okay. The irrelevant fields just just ignored in rendering.

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 from  Type

Methods

public static 
config()

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

public
mixed
stat(string $name) deprecated

Get inherited config value

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public
$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

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

from  Type
public
mixed
applyConfig(array $config)

No description

public
string|null
getName()

No description

from  Type
public
setName(string $name)

No description

from  Type
public
array
getFields()

No description

from  Type
public
setFields(array $fields)

No description

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

No description

from  Type
public
removeField(string $field)

No description

from  Type
public
Field|null
getFieldByName(string $fieldName)

No description

from  Type
public
string|null
getDescription()

No description

from  Type
public
mergeWith(Type $type)

No description

public
void
validate()

No description

public
bool
exists()

No description

from  Type
public
setDescription(string|null $description)

No description

from  Type
public
array
getInterfaces()

No description

from  Type
public
string
getEncodedInterfaces()

No description

from  Type
public
setInterfaces(array $interfaces)

No description

from  Type
public
addInterface(string $name)

No description

from  Type
public
bool
implements(string $interfaceName)

No description

from  Type
public
bool
getIsInput()

No description

from  Type
public
setIsInput(bool $isInput)

No description

from  Type
public
ResolverReference|null
getFieldResolver()

No description

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

No description

from  Type
public
string
getSignature()

No description

public
getEncodedTypeResolver()

No description

public
setTypeResolver(array|string|ResolverReference|null $resolver)

No description

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 stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

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

No description

Return Value

string

Exceptions

Exception

EncodedResolver getEncodedTypeResolver()

No description

Return Value

EncodedResolver

InterfaceType setTypeResolver(array|string|ResolverReference|null $resolver)

No description

Parameters

array|string|ResolverReference|null $resolver

Return Value

InterfaceType