Documentation

OneOnePropSvcCfg extends BasePropertyConfig implements IPropertySvcConfig

Used for PropertyFactory config

Table of Contents

$propertyName id prop name string
$modelPropertyName Model property name string
$saveFunction Optional save function closure Closure|null
$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[]
__construct() Constructor mixed
getPropertyName() Retrieve the property name used to load the backing model for a property service. string
getModelPropertyName() Retrieve the property name used for the backing model for some property service. string
getSaveFunction() Retrieve a save function to be used with some transaction. IRunnable
createConfig() Retrieve the configuration array for generating model properties. array
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

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

__construct()

Constructor

public __construct( $propertyName : string , $modelPropertyName : string [, $getSaveFunction : Closure|null = null ] [, $config : array = [] ] ) : mixed
Parameters
$propertyName : string

Parent property containing the primary key value of the model property

$modelPropertyName : string

parent property containing the model loaded by the value of $propertyName

$getSaveFunction : Closure|null = null

An OPTIONAL save function. This does not override the save function in the OneOnePropertyService

$config : array = []

A config array for a property set f( IModel $parent ) : array

Return values
mixed

getPropertyName()

Retrieve the property name used to load the backing model for a property service.

public getPropertyName( ) : string

In an alternate configuration, this property can be used as the backing array of model property name;

Return values
string

name

getModelPropertyName()

Retrieve the property name used for the backing model for some property service.

public getModelPropertyName( ) : string

In an alternate configuration, this function may return an empty string.

Return values
string

name

getSaveFunction()

Retrieve a save function to be used with some transaction.

public getSaveFunction( $parent : IModel ) : IRunnable
Parameters
$parent : IModel

Model this provider is linked to

Tags
throws
Exception
Return values
IRunnable

Something the saves data

createConfig()

Retrieve the configuration array for generating model properties.

protected createConfig( ) : array
Return values
array

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