class DataObjectModel implements SchemaModelInterface, OperationProvider, DefaultFieldsProvider, BaseFieldsProvider, ModelBlacklist (View source)

Defines the model that generates types, queries, and mutations based on DataObjects

Traits

A class that can be instantiated or replaced via DI

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

Properties

private array $operations

Methods

static Injectable
create(array ...$args)

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

static Injectable
singleton(string $class = null)

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

static Config_ForClass
config()

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

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

Update the config value for a given property

static string
getIdentifier()

No description

__construct(string $class, SchemaConfig $config)

DataObjectModel constructor.

bool
hasField(string $fieldName)

No description

ModelField|null
getField(string $fieldName, array $config = [])

No description

array
getDefaultFields()

No description

array
getBaseFields()

No description

array
getBlacklistedFields()

No description

array
getAllFields()

No description

array
getUninheritedFields()

No description

getDefaultResolver(array|null $context = [])

No description

string
getSourceClass()

No description

getFieldAccessor()

No description

setFieldAccessor(FieldAccessor $fieldAccessor)

No description

OperationCreator|null
getOperationCreatorByIdentifier(string $id)

No description

array
getAllOperationIdentifiers()

No description

ModelType|null
getModelTypeForField(string $fieldName, string $class = null)

Gets a field that resolves to another model, (e.g. an ObjectType from a has_one).

string
getPropertyForField(string $field)

No description

getDataObject()

No description

string
getTypeName()

No description

getSchemaConfig()

No description

ModelConfiguration|null
getModelConfiguration()

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

Parameters

array ...$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

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

Return Value

string

__construct(string $class, SchemaConfig $config)

DataObjectModel constructor.

Parameters

string $class
SchemaConfig $config

Exceptions

SchemaBuilderException
NotFoundExceptionInterface

bool hasField(string $fieldName)

Parameters

string $fieldName

Return Value

bool

ModelField|null getField(string $fieldName, array $config = [])

Parameters

string $fieldName
array $config

Return Value

ModelField|null

Exceptions

SchemaBuilderException

array getDefaultFields()

Return Value

array

Exceptions

SchemaBuilderException

array getBaseFields()

Return Value

array

Exceptions

SchemaBuilderException

array getBlacklistedFields()

Return Value

array

Exceptions

SchemaBuilderException

array getAllFields()

Return Value

array

Exceptions

SchemaBuilderException

array getUninheritedFields()

Return Value

array

Exceptions

SchemaBuilderException

ResolverReference getDefaultResolver(array|null $context = [])

Parameters

array|null $context

Return Value

ResolverReference

string getSourceClass()

Return Value

string

FieldAccessor getFieldAccessor()

Return Value

FieldAccessor

DataObjectModel setFieldAccessor(FieldAccessor $fieldAccessor)

Parameters

FieldAccessor $fieldAccessor

Return Value

DataObjectModel

OperationCreator|null getOperationCreatorByIdentifier(string $id)

Parameters

string $id

Return Value

OperationCreator|null

Exceptions

SchemaBuilderException

array getAllOperationIdentifiers()

Return Value

array

Exceptions

SchemaBuilderException

ModelType|null getModelTypeForField(string $fieldName, string $class = null)

Gets a field that resolves to another model, (e.g. an ObjectType from a has_one).

This method can be used to determine if a field is another model, and also to get that field.

Parameters

string $fieldName
string $class

Optional class name for model fields which would result in database queries. The database is not always available when the schema is built (e.g. on deployment servers).

Return Value

ModelType|null

Exceptions

SchemaBuilderException

string getPropertyForField(string $field)

Parameters

string $field

Return Value

string

DataObject getDataObject()

Return Value

DataObject

string getTypeName()

Return Value

string

Exceptions

SchemaBuilderException

SchemaConfig getSchemaConfig()

Return Value

SchemaConfig

ModelConfiguration|null getModelConfiguration()

Return Value

ModelConfiguration|null

Exceptions

SchemaBuilderException