ObjectPropertyBuilder extends PropertyBuilder implements IObjectPropertyBuilder
Adds the class/interface name property to the property builder
Table of Contents
$clazz | Class name | string |
---|---|---|
$createClass | A function that will create instances of the defined class. | Closure|null |
$caption | Property caption/label | string |
$defaultValue | Default property value | mixed |
$flags | Flags | SPropertyFlags |
$type | Property Type | EPropertyType |
$name | Property name | string |
$behavior | Property behavior | \buffalokiwi\magicgraph\property\IPropertyBehavior[] |
$config | Some config array if needed. | array |
$id | Optional unique id | int |
$prefix | A prefix that can be used to map something to an IModel instance | string |
$tag | An optional tag | string |
__construct() | Create a new object property builder | mixed |
setClass() | Sets the class name used for certain data types | PropertyBuilder |
getClass() | When the property type is ENUM or SET, a class name must be declared. | string |
getCreateClassClosure() | Retrieve an optional closure that returns a new instance of the object defined by the class property. | Closure|null |
__construct() | Create a new PropertyBuilder instance | mixed |
getId() | Retrieve the optionally set unique identifier for this property. | int |
setId() | Sets the optional unique identifier for this property | void |
getTag() | string | |
setTag() | void | |
getCaption() | Get the property caption/label | string |
setCaption() | Sets the property caption/label | void |
getType() | Retrieve the property type | IPropertyType |
getFlags() | Retrieve the set of flags for this property | IPropertyFlags |
setFlags() | void | |
getName() | Retrieve the property name | string |
setName() | void | |
setDefaultValue() | Sets the default property value | PropertyBuilder |
getDefaultValue() | Retrieve the default value for some property | mixed |
addBehavior() | Sets callbacks to modify the property behavior | void |
getBehavior() | Retrieve callbacks for modifying property behavior | \buffalokiwi\magicgraph\property\IPropertyBehavior[] |
setConfig() | Sets some config array if needed. | PropertyBuilder |
getConfig() | Retrieve some arbitrary config array | array |
getPrefix() | string | |
setPrefix() | void |
Properties
$clazz
Class name
private
string
$clazz
= ''
$createClass
A function that will create instances of the defined class.
private
Closure|null
$createClass
= null
$caption
Property caption/label
private
string
$caption
= ''
$defaultValue
Default property value
private
mixed
$defaultValue
$flags
Flags
private
SPropertyFlags
$flags
$type
Property Type
private
EPropertyType
$type
$name
Property name
private
string
$name
$behavior
Property behavior
private
\buffalokiwi\magicgraph\property\IPropertyBehavior[]
$behavior
= []
$config
Some config array if needed.
private
array
$config
= []
$id
Optional unique id
private
int
$id
= ""
$prefix
A prefix that can be used to map something to an IModel instance
private
string
$prefix
= ''
$tag
An optional tag
private
string
$tag
= ''
Methods
__construct()
Create a new object property builder
public
__construct(
$type :
IPropertyType
[, $flags :
IPropertyFlags
= null ]
[, $createClass :
Closure
= null ]
)
: mixed
Parameters
- $type : IPropertyType
Property type
- $flags : IPropertyFlags = null
Property flags
- $createClass : Closure = null
A function that returns an instance defined by the class property. The closure must accept a string representing the class or interface name to create an instance of.
f( string $clazz ) : instance of $clazz
Return values
mixedsetClass()
Sets the class name used for certain data types
public
setClass(
$clazz :
string
)
: PropertyBuilder
Parameters
- $clazz : string
class name
Return values
PropertyBuilder —this
getClass()
When the property type is ENUM or SET, a class name must be declared.
public
getClass(
)
: string
The defined class manages the data within the column.
Return values
string —class name
getCreateClassClosure()
Retrieve an optional closure that returns a new instance of the object defined by the class property.
public
getCreateClassClosure(
)
: Closure|null
The closure MUST return the defined type. f( string $clazz ) : instance of $clazz
Return values
Closure|null —Callback
__construct()
Create a new PropertyBuilder instance
public
__construct(
$type :
IPropertyType
[, $flags :
IPropertyFlags|null
= null ]
[, $name :
string
= '' ]
[, $defaultValue :
mixed
= null ]
[, $behavior :
IPropertyBehavior|null
= null ]
)
: mixed
Parameters
- $type : IPropertyType
- $flags : IPropertyFlags|null = null
- $name : string = ''
- $defaultValue : mixed = null
- $behavior : IPropertyBehavior|null = null
Return values
mixedgetId()
Retrieve the optionally set unique identifier for this property.
public
getId(
)
: int
This may be zero if unassigned.
Return values
int —optional id
setId()
Sets the optional unique identifier for this property
public
setId(
$id :
int
)
: void
Parameters
- $id : int
id
getTag()
public
getTag(
)
: string
Return values
stringsetTag()
public
setTag(
$tag :
string
)
: void
Parameters
- $tag : string
getCaption()
Get the property caption/label
public
getCaption(
)
: string
Return values
string —caption
setCaption()
Sets the property caption/label
public
setCaption(
$caption :
string
)
: void
Parameters
- $caption : string
caption
getType()
Retrieve the property type
public
getType(
)
: IPropertyType
Return values
IPropertyType —type
getFlags()
Retrieve the set of flags for this property
public
getFlags(
)
: IPropertyFlags
Tags
Return values
IPropertyFlags —flags
setFlags()
public
setFlags(
$flags :
IPropertyFlags
)
: void
Parameters
- $flags : IPropertyFlags
getName()
Retrieve the property name
public
getName(
)
: string
Return values
string —name
setName()
public
setName(
$name :
string
)
: void
Parameters
- $name : string
setDefaultValue()
Sets the default property value
public
setDefaultValue(
$value :
mixed
)
: PropertyBuilder
Parameters
- $value : mixed
Value
Return values
PropertyBuilder —This
getDefaultValue()
Retrieve the default value for some property
public
getDefaultValue(
)
: mixed
Return values
mixed —Default value
addBehavior()
Sets callbacks to modify the property behavior
public
addBehavior(
$behavior :
IPropertyBehavior
)
: void
Parameters
- $behavior : IPropertyBehavior
callbacks
getBehavior()
Retrieve callbacks for modifying property behavior
public
getBehavior(
)
: \buffalokiwi\magicgraph\property\IPropertyBehavior[]
Return values
\buffalokiwi\magicgraph\property\IPropertyBehavior[] —callbacks
setConfig()
Sets some config array if needed.
public
setConfig(
$config :
array
)
: PropertyBuilder
Parameters
- $config : array
Arbitrary config data
Return values
PropertyBuilder —this
getConfig()
Retrieve some arbitrary config array
public
getConfig(
)
: array
Return values
array —config
getPrefix()
public
getPrefix(
)
: string
Return values
stringsetPrefix()
public
setPrefix(
$value :
string
)
: void
Parameters
- $value : string