class CaseInsensitiveFieldAccessor

Infer original field name casing from case insensitive field comparison.

Useful counterpart to {@link \Convert::upperCamelToLowerCamel()}.

SilverStripe is using a mix of case sensitive and case insensitive checks, due to the nature of PHP (case sensitive for properties and array keys, case insensitive for methods).

Caution: Assumes fields have been whitelisted through GraphQL type definitions already. Does not perform any canView() checks or further validation.

Constants

HAS_METHOD

HAS_FIELD

HAS_SETTER

DATAOBJECT

Methods

mixed
getValue(ViewableData $object, string $fieldName, array $opts = [])

No description

mixed
setValue(ViewableData $object, string $fieldName, mixed $value, array $opts = [])

No description

null|string
getObjectFieldName(ViewableData $object, string $fieldName, array $opts = [])

No description

Details

at line 39
mixed getValue(ViewableData $object, string $fieldName, array $opts = [])

Parameters

ViewableData $object The parent resolved object
string $fieldName Name of the field/getter/method
array $opts Map of which lookups to use (class constants to booleans). Example: [ViewableDataCaseInsensitiveFieldMapper::HAS_METHOD => true]

Return Value

mixed

at line 80
mixed setValue(ViewableData $object, string $fieldName, mixed $value, array $opts = [])

Parameters

ViewableData $object The parent resolved object
string $fieldName Name of the field/getter/method
mixed $value
array $opts Map of which lookups to use (class constants to booleans). Example: [ViewableDataCaseInsensitiveFieldMapper::HAS_METHOD => true]

Return Value

mixed

at line 121
null|string getObjectFieldName(ViewableData $object, string $fieldName, array $opts = [])

Parameters

ViewableData $object The object to resolve a name on
string $fieldName Name in different casing
array $opts Map of which lookups to use (class constants to booleans). Example: [ViewableDataCaseInsensitiveFieldMapper::HAS_METHOD => true]

Return Value

null|string Name in actual casing on $object