Documentation

BasePropertyBuilderConfigMapper extends DefaultPropertyConfig implements IConfigMapper

Maps a configuration array to a list of properties.

The configuration array is as follows:

[ 'property_name' => [ //..This should be a constant from the property set interface for whatever model is being used PropertyFactory::TYPE => IPropertyType::[constant], PropertyFactory::FLAGS => [IPropertyFlags::[constant], ...], PropertyFactory::CLASS => '\namespace\classname', //(Required for TENUM,TSET and TMONEY types) PropertyFactory::MIN => 0, PropertyFactory::MAX => 100, PropertyFactory::PREPARE => function( $value, IModel $model) }, PropertyFactory::VALIDATE => function( IProperty $prop, $value ) }, PropertyFactory::PATTERN => '/[a-z]+/', //Some pattern to use as validation ] ];

Table of Contents

$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
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

Methods

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