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



array $definedValues = null
List of values which new entity must have
Default valuenull
Details- Type
- array



\Intuit\Ipp\Utility\type $model = null
Array of AbstractEntity instances, which contains complete meta data
Default valuenull
Details- Type
- \Intuit\Ipp\Utility\type



string $originalClassName = null
Contains original class name or type of converted object
Default valuenull
Details- Type
- string



\Intuit\Ipp\Utility\type $properties = null
Array of ReflectionProperties instances for the specified class
Default valuenull
Details- Type
- \Intuit\Ipp\Utility\type
Methods



__construct(\Intuit\Ipp\Utility\strign $name) : void
Requires type or class of target instance
ParametersName | Type | Description |
---|
$name | \Intuit\Ipp\Utility\strign | |
---|



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


createInstance() : mixed
Creates new instance with values
ReturnsType | Description |
---|
mixed | returns domain model instance |



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



getEntityFromModel(\Intuit\Ipp\Utility\type $index, \Intuit\Ipp\Utility\type $propertyName) : \Intuit\Ipp\Utility\AbstractEntity
Returns metadata description of property from model
ParametersName | Type | Description |
---|
$index | \Intuit\Ipp\Utility\type | |
---|
$propertyName | \Intuit\Ipp\Utility\type | |
---|
ReturnsType | Description |
---|
\Intuit\Ipp\Utility\AbstractEntity | |
ThrowsException | Description |
---|
\RuntimeException | |



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



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



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


makeReflection() : void
Create reflection based on class name
ThrowsException | Description |
---|
\InvalidArgumentException | |



populatePropertyComments() : mixed
Collect comments for defined properties. It will be used to extract meta data
ReturnsThrowsException | Description |
---|
\UnexpectedValueException | |



processPropertyValue(mixed $instance, \ReflectionProperty $property, \Intuit\Ipp\Utility\AbstractEntity $model, \Intuit\Ipp\Utility\stdClass $value) : void
Converts value into domain model object
ParametersName | 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) : void
Converts object values into domain model entities.
This function is array-compatible version of @see processPropertyValue
ParametersName | Type | Description |
---|
$instance | mixed |
- contains empty of almost ready domain model entity
|
---|
$property | \ReflectionProperty | |
---|
$model | \Intuit\Ipp\Utility\AbstractEntity | |
---|
$values | | |
---|



usePropertyValues(array $values) : void
Adds properties and their values, which will be copied into new instance
ParametersName | Type | Description |
---|
$values | array | |
---|