Documentation

DefaultConfigMapper extends BasePropertyBuilderConfigMapper

A factory for creating instances of Builders and Properties based on IPropertyType.

Maintains 2 maps:

1) A map of IPropertyType => IPropertyBuilder factory for creating property builder instances based on type 2) A map of IPropertyType => IProperty factory for creating instances of IProperty using the appropriate builder defined in step 1

Tags
todo

maybe make this extensible? Create ways to create instances of

Table of Contents

$ioc IOC container IIOC
$dateFormat Date format to use when converting Date properties to strings. string
$pbIoc PropertyBuilder instance factory IPropertyBuilderIoC
$pIoc Property factory IPropertyIoC
$propertyTypes A map of string => IPropertyType array
$getPropertyFlags Retrieve a new propertyFlags instance Closure
__construct() Create a new PropertyFactory using some configuration array mixed
createModelIOCClosure() Closure|null
getMoneyFactory() IMoneyFactory
__construct() Create a new PropertyFactory using some configuration array mixed
map() Take a config array and convert it to a list of IProperty instances. array
createPropertyBehavior() Create a new PropertyBehavior instance. IPropertyBehavior
createPropertyFlags() IPropertyFlags
setCustomProperty() Sets the builder property value based on the array key. mixed
createProperty() IProperty
createBuilder() IPropertyBuilder
setProperty() Sets the builder property value based on the array key mixed

Properties

$dateFormat

Date format to use when converting Date properties to strings.

private string $dateFormat

Methods

__construct()

Create a new PropertyFactory using some configuration array

public __construct( [ $ioc : IIOC|null = null ] [, $dateFormat : string = 'Y-m-d H:i:s' ] ) : mixed
Parameters
$ioc : IIOC|null = null

DANGER: Passing the IOC container is not inherently safe, but it is required to create IModel instances.

$dateFormat : string = 'Y-m-d H:i:s'

Date format to use when converting Date properties to strings.

Return values
mixed

map()

Take a config array and convert it to a list of IProperty instances.

public map( $config : array ) : array

If anything is wrong, exceptions get thrown.

Parameters
$config : array
Tags
throws
InvalidArgumentException
throws
Exception
Return values
array

IProperty[] list of properties defined in $config

createPropertyBehavior()

Create a new PropertyBehavior instance.

protected createPropertyBehavior( [ $validate : Closure|null = null ] [, $init : Closure|null = null ] [, $setter : Closure|null = null ] [, $getter : Closure|null = null ] [, $msetter : Closure|null = null ] [, $mgetter : Closure|null = null ] [, $onChange : Closure|null = null ] [, $isEmpty : Closure|null = null ] [, $htmlInput : Closure|null = null ] ) : IPropertyBehavior
Parameters
$validate : Closure|null = null

Validate closure f( IProperty, $value ) Throw a ValidationException on error

$init : Closure|null = null
$setter : Closure|null = null
$getter : Closure|null = null
$msetter : Closure|null = null
$mgetter : Closure|null = null
$onChange : Closure|null = null
$isEmpty : Closure|null = null
$htmlInput : Closure|null = null
Return values
IPropertyBehavior

setCustomProperty()

Sets the builder property value based on the array key.

protected setCustomProperty( $b : PropertyBuilder , $name : string , $k : string , $v : string ) : mixed

This function intentionally does nothing. Override this to handle some custom property type.

Parameters
$b : PropertyBuilder

Builder instance

$name : string

Property Name

$k : string

Property Attribute Name

$v : string

Property Attribute Value

Tags
throws
InvalidArgumentException
Return values
mixed

setProperty()

Sets the builder property value based on the array key

private setProperty( $b : PropertyBuilder , $name : string , $k : string , $v : string ) : mixed
Parameters
$b : PropertyBuilder

Builder instance

$name : string

Property Name

$k : string

Property Attribute Name

$v : string

Property Attribute Value

Tags
throws
InvalidArgumentException
Return values
mixed

Search results