Documentation

BasePropertyConfig extends DefaultPropertyConfig implements IPropertyConfig

Used for PropertyFactory config

Tags

Table of Contents

FINTEGER_PRIMARY [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::PRIMARY], self::VALUE => 0]
FINTEGER [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [], self::VALUE => 0, self::MIN => 0]
FINTEGER_SIGNED [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [], self::VALUE => 0]
FINTEGER_REQUIRED [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => 0]
FINTEGER_REQ_WE [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED, \buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY], self::VALUE => 0]
FINTEGER_WE [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY], self::VALUE => 0]
FSTRING [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TSTRING, self::FLAGS => [], self::VALUE => '']
FSTRING_REQUIRED [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TSTRING, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => '']
FSTRING_REQ_WE [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TSTRING, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED, \buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY], self::VALUE => '']
FDATE [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TDATE, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::USE_NULL], self::VALUE => null]
FDATE_ONCE [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TDATE, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY, \buffalokiwi\magicgraph\property\IPropertyFlags::USE_NULL], self::VALUE => null]
FENUM [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TENUM, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED]]
FMONEY [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TMONEY, self::FLAGS => [], self::VALUE => '0']
FMONEY_REQUIRED [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TMONEY, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => '0']
FARRAY [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TARRAY, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::NO_INSERT, \buffalokiwi\magicgraph\property\IPropertyFlags::NO_UPDATE], self::VALUE => []]
FARRAY_REQUIRED [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TARRAY, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED, \buffalokiwi\magicgraph\property\IPropertyFlags::NO_INSERT, \buffalokiwi\magicgraph\property\IPropertyFlags::NO_UPDATE], self::VALUE => []]
FDECIMAL_REQUIRED [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TFLOAT, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => 0]
FDECIMAL [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TFLOAT, self::FLAGS => [], self::VALUE => 0]
FBOOLEAN [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TBOOLEAN, self::FLAGS => [], self::VALUE => false]
FBOOLEAN_TRUE [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TBOOLEAN, self::FLAGS => [], self::VALUE => true]
CALLBACKS [self::INIT, self::VALIDATE, self::SETTER, self::GETTER, self::MSETTER, self::MGETTER, self::CHANGE, self::HTMLINPUT]
$cache Cache for config array array
$nameCache A cache of property names string[]
$behavior Behavior map array
$mValidate Model validation function from INamedPropertyBehavior Closure
$isConstructed Ghetto, but this is true if the end of the constructor has been reached. bool
$mValidateData
$beforeSave Before save events \Closure[]
$afterSave After save events \Closure[]
createConfig() Retrieve the configuration array for generating model properties. array
__construct() Constructor mixed
beforeSave() Called via SaveableMappingObjectFactory, and happens as part of the beforeSave event. void
afterSave() Called via SaveableMappingObjectFactory, and happens as part of the afterSave event. void
getValidation() Retrieve a validation callback that can be used for IModel instances. Closure
addValidation() Adds an additional validation closure to the stack. void
addBeforeSave() Adds an additional beforeSave closure to the stack. void
addAfterSave() Adds an additional afterSave closure to the stack. void
getPropertyNames() Retrieve a list of property names defined via this config array
getConfig() Retrieve the configuration array used to create model instances. array
getEnumCfg() array
removeFlagFromConfigEntry() void
addFlagToConfigEntry() mixed
createModelValidationClosure() Creates the model validation closure Closure|null
getBehavior() Retrieve any additional behavior for some property. array
addBehaviorToArray() mixed
getUsedBehavior() This is currently UNUSED. HA! array
processBehavior() Process any associated behavior for some config array array
getFunctionList() Create a list of functions for some behavior function array
getInitCallback() Create an init callback property value for multiple functions Closure|null
getOnChangeCallback() Create the on change callback Closure|null
getHTMLInputCallback() Closure|null
getValidateCallback() Create a validate callback for multiple functions. Closure|null
getGetterSetterCallback() Create a property getter/setter callback for multiple functions. Closure|null
getModelGetterSetterCallback() Create a property model setter callback for multiple functions. Closure|null
processEntry() Process a config entry. mixed

Constants

FINTEGER_PRIMARY

public mixed $FINTEGER_PRIMARY = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::PRIMARY], self::VALUE => 0]

FINTEGER

public mixed $FINTEGER = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [], self::VALUE => 0, self::MIN => 0]

FINTEGER_SIGNED

public mixed $FINTEGER_SIGNED = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [], self::VALUE => 0]

FINTEGER_REQUIRED

public mixed $FINTEGER_REQUIRED = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => 0]

FINTEGER_REQ_WE

public mixed $FINTEGER_REQ_WE = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED, \buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY], self::VALUE => 0]

FINTEGER_WE

public mixed $FINTEGER_WE = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TINTEGER, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY], self::VALUE => 0]

FSTRING

public mixed $FSTRING = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TSTRING, self::FLAGS => [], self::VALUE => '']

FSTRING_REQUIRED

public mixed $FSTRING_REQUIRED = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TSTRING, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => '']

FSTRING_REQ_WE

public mixed $FSTRING_REQ_WE = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TSTRING, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED, \buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY], self::VALUE => '']

FDATE

public mixed $FDATE = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TDATE, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::USE_NULL], self::VALUE => null]

FDATE_ONCE

public mixed $FDATE_ONCE = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TDATE, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::WRITE_EMPTY, \buffalokiwi\magicgraph\property\IPropertyFlags::USE_NULL], self::VALUE => null]

FENUM

public mixed $FENUM = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TENUM, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED]]

FMONEY

public mixed $FMONEY = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TMONEY, self::FLAGS => [], self::VALUE => '0']

FMONEY_REQUIRED

public mixed $FMONEY_REQUIRED = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TMONEY, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => '0']

FARRAY

public mixed $FARRAY = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TARRAY, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::NO_INSERT, \buffalokiwi\magicgraph\property\IPropertyFlags::NO_UPDATE], self::VALUE => []]

FARRAY_REQUIRED

public mixed $FARRAY_REQUIRED = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TARRAY, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED, \buffalokiwi\magicgraph\property\IPropertyFlags::NO_INSERT, \buffalokiwi\magicgraph\property\IPropertyFlags::NO_UPDATE], self::VALUE => []]

FDECIMAL_REQUIRED

public mixed $FDECIMAL_REQUIRED = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TFLOAT, self::FLAGS => [\buffalokiwi\magicgraph\property\IPropertyFlags::REQUIRED], self::VALUE => 0]

FDECIMAL

public mixed $FDECIMAL = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TFLOAT, self::FLAGS => [], self::VALUE => 0]

FBOOLEAN

public mixed $FBOOLEAN = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TBOOLEAN, self::FLAGS => [], self::VALUE => false]

FBOOLEAN_TRUE

public mixed $FBOOLEAN_TRUE = [self::TYPE => \buffalokiwi\magicgraph\property\IPropertyType::TBOOLEAN, self::FLAGS => [], self::VALUE => true]

CALLBACKS

public mixed $CALLBACKS = [self::INIT, self::VALIDATE, self::SETTER, self::GETTER, self::MSETTER, self::MGETTER, self::CHANGE, self::HTMLINPUT]

SETTER

Callback used for setting a properties value when it is an object.

public mixed $SETTER = 'setter'
f( IProperty, mixed $value ) : mixed

GETTER

Callback used for setting a properties value when it is an object.

public mixed $GETTER = 'getter'
f( IProperty, mixed $value ) : mixed

MSETTER

Callback used for setting a properties value when it is an object.

public mixed $MSETTER = 'msetter'
f( IModel, IProperty, mixed $value ) : mixed

MGETTER

Callback used for setting a properties value when it is an object.

public mixed $MGETTER = 'mgetter'
f( IModel, IProperty, mixed $value ) : mixed

FLAGS

Property flags.

public mixed $FLAGS = "flags"
This must map to a comma-delimited list of valid SPropertyFlags values

INIT

A callback used to initialize the default value within the model.

public mixed $INIT = "initialize"
This is called only once, when the model is first loaded. Default value is supplied, and the returned value is used as the new default value. f( mixed $defaultValue ) : mixed

VALIDATE

Closure for validating prior to save [bool is valid] = function( IProperty, [input value] )

public mixed $VALIDATE = "validate"

PREFIX

A prefix used by the default property set, which can proxy a get/set value call to a nested IModel instance.

public mixed $PREFIX = 'prefix'

HTMLINPUT

For a give property, create an htmlproperty\IElement instance used as an html form input.

public mixed $HTMLINPUT = 'htmlinput'
f( IModel $model, IProperty $property, string $name, string $id, string $value ) : IElement

IS_EMPTY

Is empty check event.

public mixed $IS_EMPTY = 'isempty'
Tests that the property value is empty f( IProperty, value ) : bool

TAG

An optional tag for the attribute.

public mixed $TAG = 'tag'
This can be any string, and can be used for whatever.

Properties

$mValidate

Model validation function from INamedPropertyBehavior

private Closure $mValidate = null

$isConstructed

Ghetto, but this is true if the end of the constructor has been reached.

private bool $isConstructed = false

Methods

createConfig()

Retrieve the configuration array for generating model properties.

protected abstract createConfig( ) : array
Return values
array

__construct()

Constructor

public __construct( ...$behavior : INamedPropertyBehavior ) : mixed
Parameters
$behavior : INamedPropertyBehavior

Additional property behavior NOTE: the beforeSave and afterSave property behavior methods are unlikely to work with standard IPropertyService implementations. Functioning would be based on the controlling service. All IModelPropertyProvider implementations can take advantage of beforeSave() and afterSave().

Return values
mixed

beforeSave()

Called via SaveableMappingObjectFactory, and happens as part of the beforeSave event.

public final beforeSave( $model : IModel ) : void
Parameters
$model : IModel

Model being saved

Tags
final

afterSave()

Called via SaveableMappingObjectFactory, and happens as part of the afterSave event.

public final afterSave( $model : IModel ) : void
Parameters
$model : IModel

Model being saved

Tags
final

getValidation()

Retrieve a validation callback that can be used for IModel instances.

public final getValidation( ) : Closure
Tags
final
Return values
Closure

f( IModel $model ) throws ValidationException

addValidation()

Adds an additional validation closure to the stack.

protected final addValidation( $f : Closure ) : void
Parameters
$f : Closure

New validation function. f( IModel $model ) : void throws ValidationException

Tags
final

addBeforeSave()

Adds an additional beforeSave closure to the stack.

protected final addBeforeSave( $f : Closure ) : void
Parameters
$f : Closure

New beforeSAve function. f( IModel $model ) : void

Tags
final

addAfterSave()

Adds an additional afterSave closure to the stack.

protected final addAfterSave( $f : Closure ) : void
Parameters
$f : Closure

New afterSave function. f( IModel $model ) : void

Tags
final

getPropertyNames()

Retrieve a list of property names defined via this config

public getPropertyNames( ) : array
Return values
array

names

getConfig()

Retrieve the configuration array used to create model instances.

public getConfig( ) : array
Return values
array

config data

getEnumCfg()

protected getEnumCfg( $class : string [, $value : mixed = '' ] ) : array
Parameters
$class : string
$value : mixed = ''
Return values
array

removeFlagFromConfigEntry()

protected removeFlagFromConfigEntry( &$entry : array , $flag : string ) : void
Parameters
$entry : array
$flag : string

addFlagToConfigEntry()

protected addFlagToConfigEntry( &$entry : array , $flag : string ) : mixed
Parameters
$entry : array
$flag : string
Return values
mixed

createModelValidationClosure()

Creates the model validation closure

private createModelValidationClosure( $mValidate : array ) : Closure|null
Parameters
$mValidate : array

Closure[] behavior closures

Return values
Closure|null

function

getBehavior()

Retrieve any additional behavior for some property.

private getBehavior( $property : string ) : array

If none is assigned, then an empty array is returned.

Parameters
$property : string

Property name

Return values
array

INamedPropertyBehavior[] additional behavior

addBehaviorToArray()

private addBehaviorToArray( &$out : mixed , $key : string , $f : Closure|null ) : mixed
Parameters
$out : mixed
$key : string
$f : Closure|null
Return values
mixed

processBehavior()

Process any associated behavior for some config array

private processBehavior( $config : array ) : array
Parameters
$config : array

config array

Return values
array

modified array

getFunctionList()

Create a list of functions for some behavior function

private getFunctionList( $method : string , ...$behavior : INamedPropertyBehavior ) : array
Parameters
$method : string

Behavior function to call.

$behavior : INamedPropertyBehavior

Behavior objects

Return values
array

\Closure[] list of additional behavior functions

getInitCallback()

Create an init callback property value for multiple functions

private getInitCallback( $value : Closure|null , ...$functions : Closure ) : Closure|null
Parameters
$value : Closure|null

Closure|null from property config array

$functions : Closure

A list of additional init functions

Return values
Closure|null

Combined function

getOnChangeCallback()

Create the on change callback

private getOnChangeCallback( $value : Closure|null , ...$functions : Closure ) : Closure|null
Parameters
$value : Closure|null

Closure|null from property config array

$functions : Closure

A list of additional functions

Return values
Closure|null

Combined function

getHTMLInputCallback()

private getHTMLInputCallback( $value : Closure|null , ...$functions : Closure ) : Closure|null
Parameters
$value : Closure|null

Closure|null from property config array

$functions : Closure

A list of additional functions

Return values
Closure|null

Combined function

getValidateCallback()

Create a validate callback for multiple functions.

private getValidateCallback( $value : Closure|null , ...$functions : Closure ) : Closure|null
Parameters
$value : Closure|null

Closure|null from property config array

$functions : Closure

A list of additional functions

Return values
Closure|null

Combined function

getGetterSetterCallback()

Create a property getter/setter callback for multiple functions.

private getGetterSetterCallback( $value : Closure|null , ...$functions : Closure ) : Closure|null
Parameters
$value : Closure|null

Closure|null from property config array

$functions : Closure

A list of additional functions

Return values
Closure|null

Combined function

getModelGetterSetterCallback()

Create a property model setter callback for multiple functions.

private getModelGetterSetterCallback( $value : Closure|null , ...$functions : Closure ) : Closure|null
Parameters
$value : Closure|null

Closure|null from property config array

$functions : Closure

A list of additional functions

Return values
Closure|null

Combined function

processEntry()

Process a config entry.

private processEntry( $prop : string , $value : mixed , ...$behavior : INamedPropertyBehavior ) : mixed

For any callbacks attached to the config, concatenate that callback with any attached to some named property behavior.

Parameters
$prop : string

Property name

$value : mixed

Config entry property value

$behavior : INamedPropertyBehavior

Behavior for this property

Return values
mixed

value

Search results