Documentation

ProxyModel implements IModel

Delegates all method calls to the supplied model instance.

Table of Contents

$model Model instance IModel
$hasGet
$hasSet
$hasIsset
__construct() Model to use mixed
getIterator() Retrieve an external iterator <p>Returns an external iterator.</p> Traversable
createCopy() Create a copy/clone of the model and all properties. IModel
clearEditFlags() Clears the internal edited flags for each property void
instanceOf() A way to determine if this model is an instance of some interface. bool
__call() Used for any method not part of IModel. type
__isset() Determine if $name matches a property name defined in the IPropertySet instance supplied to the constructor. bool
__get() Generic getter. mixed
__set() Sets some property value. mixed
getPropertyConfig() Retrieve a property config instance attached to this model. IPropertyConfig
getPropertySet() Retrieve the property set used for this model. IPropertySet
hasEdits() Detect if any properties have been edited in this model bool
getPropertyNameSet() Retrieve property names as an IBigSet instance. IBigSet
getPropertyNameSetByFlags() Retrieve a set with the property name bits toggled on for properties with the supplied flags. IBigSet
toObject() Convert the model to a json representation. string
toArray() Convert this model to an array. array
equals() Test if this model is equal to some other model bool
getValue() Retrieve the value of some property mixed
setValue() Sets the value of some property void
getModifiedProperties() Retrieve a list of modified properties ISet
getInsertProperties() Gets A propertyset containing properties for insert IBigSet
validate() Test to see if this model is valid prior to save() void
validateAll() If you want to validate each property and return a list of errors indexed by property name, this is the method to call. array
hash() Retrieve a unique hash for this object string
getModel() Retrieves the model IModel
fromArray() void
hasPrimaryKeyValues() Test that the model has all primary key values bool

Properties

Methods

__construct()

Model to use

public __construct( $model : IModel ) : mixed
Parameters
$model : IModel

Model to pass calls to

Return values
mixed

createCopy()

Create a copy/clone of the model and all properties.

public createCopy( [ $copyIsSaveable : bool = true ] ) : IModel
Parameters
$copyIsSaveable : bool = true

If this is false, then the primary key flags are removed from the copied model. This will cause the repository save method

Return values
IModel

Copied model

clearEditFlags()

Clears the internal edited flags for each property

public clearEditFlags( ) : void

instanceOf()

A way to determine if this model is an instance of some interface.

public final instanceOf( $interface : string ) : bool

This is used due to decorators.

Parameters
$interface : string

Interface name

Tags
final
Return values
bool

if this implements it

__call()

Used for any method not part of IModel.

public __call( $name : string , $arguments : array ) : type
Parameters
$name : string
$arguments : array
Tags
throws
Exception
Return values
type

__isset()

Determine if $name matches a property name defined in the IPropertySet instance supplied to the constructor.

public __isset( $name : string ) : bool

Calls IPropertySet::isMember()

Parameters
$name : string

property name

Tags
see
ISet::isMember()
Return values
bool

is set

__get()

Generic getter.

public __get( $p : string ) : mixed

Alias of getValue()

Parameters
$p : string

Property name

Tags
see
DefaultModel::getValue()
Return values
mixed

Property value

__set()

Sets some property value.

public __set( $p : string , $v : mixed ) : mixed

Alias of setValue()

Parameters
$p : string

Property name

$v : mixed

Property value

Tags
see
DefaultModel::setValue()
Return values
mixed

getPropertyConfig()

Retrieve a property config instance attached to this model.

public getPropertyConfig( $intf : string ) : IPropertyConfig
Parameters
$intf : string

Interface of the config instance

Tags
throws
Exception

if The requested interface was not used to build this model.

Return values
IPropertyConfig

The config instance

getPropertySet()

Retrieve the property set used for this model.

public getPropertySet( ) : IPropertySet

This MUST return a clone of the backing property set and never the one used internally to set values.

Tags
reutrn

IPropertySet properties

Return values
IPropertySet

hasEdits()

Detect if any properties have been edited in this model

public hasEdits( [ $prop : string = '' ] ) : bool
Parameters
$prop : string = ''

Property name. If $prop is not empty then this would test that the supplied property name is not empty. Otherwise, this tests if any property was edited.

Return values
bool

has edits

getPropertyNameSet()

Retrieve property names as an IBigSet instance.

public getPropertyNameSet( ) : IBigSet

This will return a set containing all of the property names, and have zero members active. This is available due to how expensive cloning the backing IPropertySet instance can be. Use this for simple operations such as determining if a property name is valid.

Return values
IBigSet

property names

getPropertyNameSetByFlags()

Retrieve a set with the property name bits toggled on for properties with the supplied flags.

public getPropertyNameSetByFlags( ...$flags : string ) : IBigSet
Parameters
$flags : string

Flags

Return values
IBigSet

names

toObject()

Convert the model to a json representation.

public toObject( [ $properties : IBigSet|null = null ] [, $includeArrays : bool = false ] [, $includeModels : bool = false ] ) : string
Parameters
$properties : IBigSet|null = null
$includeArrays : bool = false
$includeModels : bool = false
Return values
string

JSON object

toArray()

Convert this model to an array.

public toArray( [ $properties : IPropertySet = null ] [, $includeArrays : bool = false ] [, $includeModels : bool = false ] ) : array
Parameters
$properties : IPropertySet = null

Properties to include

$includeArrays : bool = false
$includeModels : bool = false
Return values
array

equals()

Test if this model is equal to some other model

public equals( $that : IModel ) : bool
Parameters
$that : IModel

model to compare

Return values
bool

is equals

getValue()

Retrieve the value of some property

public getValue( $property : string [, $context : array = [] ] ) : mixed
Parameters
$property : string

Property

$context : array = []
Tags
throws
InvalidArgumentException

if the property is invalid

Return values
mixed

value

setValue()

Sets the value of some property

public setValue( $property : string , $value : mixed ) : void
Parameters
$property : string

Property to set

$value : mixed

property value

Tags
throws
InvalidArgumentException

if the property is invalid

getModifiedProperties()

Retrieve a list of modified properties

public getModifiedProperties( ) : ISet
Return values
ISet

modified properties

getInsertProperties()

Gets A propertyset containing properties for insert

public getInsertProperties( ) : IBigSet
Return values
IBigSet

insert properties

validateAll()

If you want to validate each property and return a list of errors indexed by property name, this is the method to call.

public validateAll( [ $debugErrors : bool = false ] ) : array

Note: This simply calls validate() in a loop, catches exceptions and tosses some errors in a list.

Parameters
$debugErrors : bool = false
Return values
array

[property name => message]

hash()

Retrieve a unique hash for this object

public hash( ) : string
Return values
string

hash

fromArray()

public fromArray( $data : array ) : void
Parameters
$data : array

hasPrimaryKeyValues()

Test that the model has all primary key values

public hasPrimaryKeyValues( ) : bool
Return values
bool

has values

Search results