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.

Config options

dependencies array

Properties

Methods

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

No description

public
__construct(string $class, SchemaConfig $config)

DataObjectModel constructor.

public
bool
hasField(string $fieldName)

No description

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

No description

public
array
getDefaultFields()

No description

public
array
getBaseFields()

No description

public
array
getBlacklistedFields()

No description

public
array
getAllFields()

No description

public
array
getUninheritedFields()

No description

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

No description

public
string
getSourceClass()

No description

public
getFieldAccessor()

No description

public
setFieldAccessor(FieldAccessor $fieldAccessor)

No description

public
OperationCreator|null
getOperationCreatorByIdentifier(string $id)

No description

public
array
getAllOperationIdentifiers()

No description

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

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

public
string
getPropertyForField(string $field)

No description

public
getDataObject()

No description

public
string
getTypeName()

No description

public
getSchemaConfig()

No description

public
ModelConfiguration|null
getModelConfiguration()

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

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

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

No description

Return Value

string

__construct(string $class, SchemaConfig $config)

DataObjectModel constructor.

Parameters

string $class
SchemaConfig $config

Exceptions

SchemaBuilderException
NotFoundExceptionInterface

bool hasField(string $fieldName)

No description

Parameters

string $fieldName

Return Value

bool

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

No description

Parameters

string $fieldName
array $config

Return Value

ModelField|null

Exceptions

SchemaBuilderException

array getDefaultFields()

No description

Return Value

array

Exceptions

SchemaBuilderException

array getBaseFields()

No description

Return Value

array

Exceptions

SchemaBuilderException

array getBlacklistedFields()

No description

Return Value

array

Exceptions

SchemaBuilderException

array getAllFields()

No description

Return Value

array

Exceptions

SchemaBuilderException

array getUninheritedFields()

No description

Return Value

array

Exceptions

SchemaBuilderException

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

No description

Parameters

array|null $context

Return Value

ResolverReference

string getSourceClass()

No description

Return Value

string

FieldAccessor getFieldAccessor()

No description

Return Value

FieldAccessor

DataObjectModel setFieldAccessor(FieldAccessor $fieldAccessor)

No description

Parameters

FieldAccessor $fieldAccessor

Return Value

DataObjectModel

OperationCreator|null getOperationCreatorByIdentifier(string $id)

No description

Parameters

string $id

Return Value

OperationCreator|null

Exceptions

SchemaBuilderException

array getAllOperationIdentifiers()

No description

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)

No description

Parameters

string $field

Return Value

string

DataObject getDataObject()

No description

Return Value

DataObject

string getTypeName()

No description

Return Value

string

Exceptions

SchemaBuilderException

SchemaConfig getSchemaConfig()

No description

Return Value

SchemaConfig

ModelConfiguration|null getModelConfiguration()

No description

Return Value

ModelConfiguration|null

Exceptions

SchemaBuilderException