BeanContext/Decorator.php

Show: inherited
Table of Contents

\Conjoon_BeanContext_Decorator

Package: Conjoon\BeanContext\BeanContext

A decorator for casting return values of specified model-methods to their applicable objects. If no susbstiute for the specified method to decorate can be found, the method/property of the decorated class will be used.

A ModelDecorator casts abstract storage data to the entities they represent.

Author
Thorsten Suckow-Homberg  
Category
BeanContext  

Constants

Constant  TYPE_DTO = 'dto'
Constant  TYPE_ENTITY = 'entity'
Constant  TYPE_ARRAY = 'array'
Constant  TYPE_DEFAULT = 'default'

Properties

Propertyprotectedarray  $_decoratedMethods= 'array()'

Default valuearray()Details
Type
array
Propertyprotectedmixed  $_decoratedModel= 'null'

Default valuenullDetails
Type
mixed
Propertyprotectedstring  $_entity= 'null'

Default valuenullDetails
Type
string
Propertyprotected\Conjoon_Filter_Input  $_filter= 'null'

Default valuenullDetails
Type
\Conjoon_Filter_Input
Propertyprotectedboolean  $_strict= 'true'

Default valuetrueDetails
Type
boolean

Methods

methodpublic__call( string $method, array $arguments ) : mixed
final

Method tries to determine if the called method was defined in $_decoratedMethods. If this is the case, the return values will be casted to instances of teh class defined in $_entity.

If the method called was not found in $_decorated, the method will be called on the object this class decorates.

Parameters
Name Type Description
$method string

The method name called

$arguments array

The arguments passed.

Returns
Type Description
mixed
methodpublic__construct( \Conjoon_BeanContext_Decoratable $mixed, \Conjoon_Filter_Input $filter = null, boolean $strict = true ) : void
final

Constructor

Parameters
Name Type Description
$mixed \Conjoon_BeanContext_Decoratable

The table class to model, or the classname as a string of the model to decorate. The class will then try to load the class and instantiate it with no arguments.

$filter \Conjoon_Filter_Input

An optional filter that gets processed before the data is returned. The flter will only be used if teh data is decorated as dto or entity

$strict boolean

if set to false, mising setters for any property available will not throw an exception

Throws
Exception Description
\Exception
methodprotected_cast(  $values,  $type ) : mixed
final

Tries to cast a numeric/associative array into it's representant entity model as defined in $_entity.

Parameters
Name Type Description
$values
$type
Returns
Type Description
mixed Either an array of objects or a single object.
Documentation was generated by DocBlox 0.18.1.