PropertyFactory implements IPropertyFactory
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
$mapper | Config mapper | IConfigMapper |
---|---|---|
__construct() | Create a new PropertyFactory using some configuration array | mixed |
getMapper() | Retrieve the config mapper used to create IProperty instances from config arrays. | IConfigMapper |
getProperties() | Retrieve a list of properties | \buffalokiwi\magicgraph\property\IProperty[] |
Properties
$mapper
Config mapper
private
IConfigMapper
$mapper
Methods
__construct()
Create a new PropertyFactory using some configuration array
public
__construct(
$mapper :
IConfigMapper
)
: mixed
Parameters
- $mapper : IConfigMapper
Return values
mixedgetMapper()
Retrieve the config mapper used to create IProperty instances from config arrays.
public
getMapper(
)
: IConfigMapper
Return values
IConfigMapper —Mapper
getProperties()
Retrieve a list of properties
public
getProperties(
...$config :
IPropertyConfig
)
: \buffalokiwi\magicgraph\property\IProperty[]
Parameters
- $config : IPropertyConfig
One or more configuration instances.
Return values
\buffalokiwi\magicgraph\property\IProperty[] —properties