Utility/DomainEntityBuilder.php
- Package
- Default
\Intuit\Ipp\Utility\DomainEntityBuilder
Package: DefaultConverts stdClass object into domain object
- Author
- amatiushkin
Properties



array $definedValues = nullList of values which new entity must have
Default valuenullDetails- Type
- array



\Intuit\Ipp\Utility\type $model = nullArray of AbstractEntity instances, which contains complete meta data
Default valuenullDetails- Type
- \Intuit\Ipp\Utility\type



string $originalClassName = nullContains original class name or type of converted object
Default valuenullDetails- Type
- string



\Intuit\Ipp\Utility\type $properties = nullArray of ReflectionProperties instances for the specified class
Default valuenullDetails- Type
- \Intuit\Ipp\Utility\type
Methods



__construct(\Intuit\Ipp\Utility\strign $name) : voidRequires type or class of target instance
Parameters| Name | Type | Description |
|---|
| $name | \Intuit\Ipp\Utility\strign | |
|---|



create(string $type, array $values) : mixedstaticCreates instance of specified type and returns it as result.
Parameters| Name | Type | Description |
|---|
| $type | string | |
|---|
| $values | array | |
|---|
Returns 


createInstance() : mixedCreates new instance with values
Returns| Type | Description |
|---|
| mixed | returns domain model instance |



forgeInstance( $instance) : mixedCreates new instance of target class with specified values
It also adjusts any nested type based on suplied metadata (@var annotation)
Parameters| Name | Type | Description |
|---|
| $instance | | |
|---|
Returns| Type | Description |
|---|
| mixed | returns domain model instance |



getEntityFromModel(\Intuit\Ipp\Utility\type $index, \Intuit\Ipp\Utility\type $propertyName) : \Intuit\Ipp\Utility\AbstractEntityReturns metadata description of property from model
Parameters| Name | Type | Description |
|---|
| $index | \Intuit\Ipp\Utility\type | |
|---|
| $propertyName | \Intuit\Ipp\Utility\type | |
|---|
Returns| Type | Description |
|---|
| \Intuit\Ipp\Utility\AbstractEntity | |
Throws| Exception | Description |
|---|
| \RuntimeException | |



getOriginalClassName() : \Intuit\Ipp\Utility\typeReturns target class name or type of new instance
Returns| Type | Description |
|---|
| \Intuit\Ipp\Utility\type | |



getReflection() : \ReflectionClassReturns reflection object for target class
Returns| Type | Description |
|---|
| \ReflectionClass | |



isMorhing(\Intuit\Ipp\Utility\AbstractEntity $entity, \Intuit\Ipp\Utility\stdClass $value) : booleanReturns true if value can be converted into domain model instance
Parameters| Name | Type | Description |
|---|
| $entity | \Intuit\Ipp\Utility\AbstractEntity | |
|---|
| $value | \Intuit\Ipp\Utility\stdClass | |
|---|
Returns 


makeReflection() : voidCreate reflection based on class name
Throws| Exception | Description |
|---|
| \InvalidArgumentException | |



populatePropertyComments() : mixedCollect comments for defined properties. It will be used to extract meta data
ReturnsThrows| Exception | Description |
|---|
| \UnexpectedValueException | |



processPropertyValue(mixed $instance, \ReflectionProperty $property, \Intuit\Ipp\Utility\AbstractEntity $model, \Intuit\Ipp\Utility\stdClass $value) : voidConverts value into domain model object
Parameters| Name | Type | Description |
|---|
| $instance | mixed |
- contains empty of almost ready domain model entity
|
|---|
| $property | \ReflectionProperty | |
|---|
| $model | \Intuit\Ipp\Utility\AbstractEntity | |
|---|
| $value | \Intuit\Ipp\Utility\stdClass | |
|---|



processPropertyValues(mixed $instance, \ReflectionProperty $property, \Intuit\Ipp\Utility\AbstractEntity $model, $values) : voidConverts object values into domain model entities.
This function is array-compatible version of @see processPropertyValue
Parameters| Name | Type | Description |
|---|
| $instance | mixed |
- contains empty of almost ready domain model entity
|
|---|
| $property | \ReflectionProperty | |
|---|
| $model | \Intuit\Ipp\Utility\AbstractEntity | |
|---|
| $values | | |
|---|



usePropertyValues(array $values) : voidAdds properties and their values, which will be copied into new instance
Parameters| Name | Type | Description |
|---|
| $values | array | |
|---|