class DataObjectScaffolder implements ManagerMutatorInterface, ScaffolderInterface, ConfigurationApplier (View source)

Scaffolds a DataObjectTypeCreator.

Traits

Offers a few helper methods for classes that are DataObject subclass bound.

Extensible

Properties

static private array $default_fields

Minimum fields that any type will expose. Useful for implicitly created types, e.g. exposing a has_one.

Methods

string
getDataObjectClass()

No description

DataObject
getDataObjectInstance()

No description

$this
setDataObjectClass(string $class)

Sets the DataObject name

__construct(string $dataObjectClass)

DataObjectScaffold constructor.

string
getTypeName()

Name of graphql type

$this
addFields(array $fieldData)

Adds visible fields, and optional descriptions.

$this
addField(string $field, string $description = null)

No description

$this
addAllFields(bool $includeHasOne = false)

Adds all db fields, and optionally has_one.

$this
addAllFieldsExcept(array|string $exclusions, bool $includeHasOne = false)

Adds fields against a blacklist.

$this
removeField(string $field)

No description

$this
removeFields(array $fields)

No description

ArrayList
getFields()

No description

getOperations()

No description

getNestedQueries()

No description

$this
setFieldDescription(string $field, string $description)

Sets the description to an existing field.

string
getFieldDescription(string $field)

Gets the Description property from a field, given a name

$this
removeOperation(string $identifier)

Removes an operation.

$this
addAllOperations()

Adds all operations that are registered

operation(string $operation)

Find or make an operation.

nestedQuery(string $fieldName, QueryScaffolder $queryScaffolder = null)

Finds or adds a nested query, e.g. has_many/many_many relation, or a query created with a custom scaffolder

array
getDependentClasses()

Gets types for all ancestors of this class that will need to be added.

array
getAncestralClasses() deprecated

Gets the class ancestry back to DataObject.

cloneTo(DataObjectScaffolder $target)

Clones this scaffolder to another class, copying over only valid fields and operations

applyConfig(array $config)

Applies settings from an array, i.e. YAML

mixed
scaffold(Manager $manager)

No description

addToManager(Manager $manager)

Adds the type to the Manager.

Details

string getDataObjectClass()

Return Value

string

DataObject getDataObjectInstance()

Return Value

DataObject

$this setDataObjectClass(string $class)

Sets the DataObject name

Parameters

string $class

Return Value

$this

$this setChainableParent(DataObjectScaffolder|SchemaScaffolder $parent)

Set parent

Parameters

DataObjectScaffolder|SchemaScaffolder $parent

Return Value

$this

__construct(string $dataObjectClass)

DataObjectScaffold constructor.

Parameters

string $dataObjectClass

string getTypeName()

Name of graphql type

Return Value

string

$this addFields(array $fieldData)

Adds visible fields, and optional descriptions.

Ex: [ 'MyField' => 'Some description', 'MyOtherField' // No description ]

Parameters

array $fieldData

Return Value

$this

$this addField(string $field, string $description = null)

Parameters

string $field
string $description

Return Value

$this

$this addAllFields(bool $includeHasOne = false)

Adds all db fields, and optionally has_one.

Parameters

bool $includeHasOne

Return Value

$this

$this addAllFieldsExcept(array|string $exclusions, bool $includeHasOne = false)

Adds fields against a blacklist.

Parameters

array|string $exclusions
bool $includeHasOne

Return Value

$this

$this removeField(string $field)

Parameters

string $field

Return Value

$this

$this removeFields(array $fields)

Parameters

array $fields

Return Value

$this

ArrayList getFields()

Return Value

ArrayList

OperationList getOperations()

Return Value

OperationList

OperationList getNestedQueries()

Return Value

OperationList

$this setFieldDescription(string $field, string $description)

Sets the description to an existing field.

Parameters

string $field
string $description

Return Value

$this

string getFieldDescription(string $field)

Gets the Description property from a field, given a name

Parameters

string $field

Return Value

string

Exceptions

Exception

$this removeOperation(string $identifier)

Removes an operation.

Parameters

string $identifier

Return Value

$this

$this addAllOperations()

Adds all operations that are registered

Return Value

$this

OperationScaffolder operation(string $operation)

Find or make an operation.

Parameters

string $operation

Return Value

OperationScaffolder

OperationScaffolder|ListQueryScaffolder nestedQuery(string $fieldName, QueryScaffolder $queryScaffolder = null)

Finds or adds a nested query, e.g. has_many/many_many relation, or a query created with a custom scaffolder

Parameters

string $fieldName
QueryScaffolder $queryScaffolder

Return Value

OperationScaffolder|ListQueryScaffolder

array getDependentClasses()

Gets types for all ancestors of this class that will need to be added.

Return Value

array

array getAncestralClasses() deprecated

deprecated 2.0.0..3.0.0 Use StaticSchema::getAncestry($class) instead

Gets the class ancestry back to DataObject.

Return Value

array

DataObjectScaffolder cloneTo(DataObjectScaffolder $target)

Clones this scaffolder to another class, copying over only valid fields and operations

Parameters

DataObjectScaffolder $target

Return Value

DataObjectScaffolder

applyConfig(array $config)

Applies settings from an array, i.e. YAML

Parameters

array $config

Exceptions

Exception

mixed scaffold(Manager $manager)

Parameters

Manager $manager

Return Value

mixed

addToManager(Manager $manager)

Adds the type to the Manager.

Parameters

Manager $manager