Documentation

IStringProperty extends IBoundedProperty

A property that holds a string as a value.

This can be validated using regular expressions or a simple min/max length setting.

Table of Contents

getPattern() Retrieve a regular expression used to validate the string property value during calls to IProperty::validate(). string
getValueAsString() Retrieve the property value as a string string
getMin() Sets the minimum string length of the value. int
getMax() Sets the maximum string length of the value. int
setReadOnly() Sets the property set to read only. void
getPrefix() Retrieve the prefix used to identify properties of a child model. string
getConfig() Retrieve random config data mixed
getId() Retrieve the optionally set unique identifier for this property. int
getCaption() Retrieve the attribute caption/label. string
reset() Initialize and/or reset the property state to default. IProperty
getName() Retrieve the property name string
getType() Retrieve the property type IPropertyType
getFlags() Retrieve the set of flags for this property IPropertyFlags
getPropertyBehavior() Retrieve the object containing callbacks that can modify some behavior of the property. \buffalokiwi\magicgraph\property\IPropertyBehavior[]
validate() Test to see if some value is valid void
getDefaultValue() Retrieve the default value for some property mixed
setValue() Sets the property value void
getValue() Retrieve the stored property value mixed
__toString() All properties must be able to be cast to a string string
getTag() Retrieve the tag value for this attribute string

Methods

getPattern()

Retrieve a regular expression used to validate the string property value during calls to IProperty::validate().

public getPattern( ) : string
Return values
string

regex

getValueAsString()

Retrieve the property value as a string

public getValueAsString( ) : string
Return values
string

getMin()

Sets the minimum string length of the value.

public getMin( ) : int

Set to -1 for unused. Used in IProperty::validate();

Return values
int

Minimum length or -1

getMax()

Sets the maximum string length of the value.

public getMax( ) : int

Set to -1 for unused. Used in IProperty::validate();

Return values
int

Maximum length or -1

setReadOnly()

Sets the property set to read only.

public setReadOnly( ) : void

This is a method because the model still needs to be written to when creating instances populated from persistent storage. The idea is for the mapping object factory to call this method after filling the model, but before returning it.

getPrefix()

Retrieve the prefix used to identify properties of a child model.

public getPrefix( ) : string

ie: parent model has property foo_bar child model has property bar

Prefix = foo_

parent->foo_bar = 'baz';

sets bar equal to 'baz' in the child model.

Return values
string

getConfig()

Retrieve random config data

public getConfig( ) : mixed
Return values
mixed

getId()

Retrieve the optionally set unique identifier for this property.

public getId( ) : int

This may be zero if unassigned.

Return values
int

optional id

getCaption()

Retrieve the attribute caption/label.

public getCaption( ) : string

If no caption is listed, this returns name.

Return values
string

reset()

Initialize and/or reset the property state to default.

public reset( ) : IProperty

First checks for an init callback attached to IPropertyBehavior. If it exists, then the result of that callback is used as the default value, otherwise the default value specified during object construction is used.

Second, calls setValue() with the derived default value.

This allows the default value to go through validation.

I really don't like this, but it makes object construction more clear.

Tags
throws
InvalidArgumentException
throws
ValidationException
Return values
IProperty

this - Makes object initialization a single statement.

getName()

Retrieve the property name

public getName( ) : string
Return values
string

name

getPropertyBehavior()

Retrieve the object containing callbacks that can modify some behavior of the property.

public getPropertyBehavior( ) : \buffalokiwi\magicgraph\property\IPropertyBehavior[]
Return values
\buffalokiwi\magicgraph\property\IPropertyBehavior[]

getDefaultValue()

Retrieve the default value for some property

public getDefaultValue( ) : mixed
Return values
mixed

Default value

getValue()

Retrieve the stored property value

public getValue( [ $context : array = [] ] ) : mixed
Parameters
$context : array = []
Return values
mixed

value

__toString()

All properties must be able to be cast to a string

public __toString( ) : string
Return values
string

property value

getTag()

Retrieve the tag value for this attribute

public getTag( ) : string
Return values
string

tag

Search results