ObjectConverter extends AbstractTypeConverter
This converter transforms arrays to simple objects (POPO) by setting properties.
Table of Contents
Constants
Properties
- $container : ContainerInterface
- $objectContainer : Container
- $objectManager : ObjectManagerInterface
- $priority : int
- The priority for this converter.
- $reflectionService : ReflectionService
- $sourceTypes : array<string|int, mixed>
- The source types this converter can convert.
- $targetType : string
- The target type this converter can convert to.
Methods
- canConvertFrom() : bool
- Only convert non-persistent types
- convertFrom() : object|null
- Convert an object from $source to an object.
- getPriority() : int
- Return the priority of this TypeConverter. TypeConverters with a high priority are chosen before low priority.
- getSourceChildPropertiesToBeConverted() : array<string|int, mixed>
- Convert all properties in the source array
- getSupportedSourceTypes() : array<string|int, string>
- Returns the list of source types the TypeConverter can handle.
- getSupportedTargetType() : string
- Return the target type this TypeConverter converts to.
- getTargetTypeForSource() : string
- Determines the target type based on the source's (optional) __type key.
- getTypeOfChildProperty() : string
- The type of a property is determined by the reflection service.
- injectContainer() : mixed
- injectObjectContainer() : void
- injectObjectManager() : void
- injectReflectionService() : void
- buildObject() : object
- Builds a new instance of $objectType with the given $possibleConstructorArgumentValues. If constructor argument values are missing from the given array the method looks for a default value in the constructor signature. Furthermore, the constructor arguments are removed from $possibleConstructorArgumentValues: They are considered "handled" by __construct and will not be mapped calling setters later.
Constants
CONFIGURATION_OVERRIDE_TARGET_TYPE_ALLOWED
public
int
CONFIGURATION_OVERRIDE_TARGET_TYPE_ALLOWED
= 4
CONFIGURATION_TARGET_TYPE
public
int
CONFIGURATION_TARGET_TYPE
= 3
Properties
$container
protected
ContainerInterface
$container
$objectContainer
since v11, will be removed in v12.
protected
Container
$objectContainer
$objectManager
since v11, will be removed in v12
protected
ObjectManagerInterface
$objectManager
$priority
The priority for this converter.
protected
int
$priority
= 10
$reflectionService
protected
ReflectionService
$reflectionService
$sourceTypes
The source types this converter can convert.
protected
array<string|int, mixed>
$sourceTypes
= ['array']
$targetType
The target type this converter can convert to.
protected
string
$targetType
= 'object'
Methods
canConvertFrom()
Only convert non-persistent types
public
canConvertFrom(mixed $source, string $targetType) : bool
Parameters
- $source : mixed
- $targetType : string
only to be used within Extbase, not part of TYPO3 Core API.
Return values
boolconvertFrom()
Convert an object from $source to an object.
public
convertFrom(mixed $source, string $targetType[, array<string|int, mixed> $convertedChildProperties = [] ][, PropertyMappingConfigurationInterface $configuration = null ]) : object|null
Parameters
- $source : mixed
- $targetType : string
- $convertedChildProperties : array<string|int, mixed> = []
- $configuration : PropertyMappingConfigurationInterface = null
only to be used within Extbase, not part of TYPO3 Core API.
Tags
Return values
object|null —the target type
getPriority()
Return the priority of this TypeConverter. TypeConverters with a high priority are chosen before low priority.
public
getPriority() : int
Return values
intgetSourceChildPropertiesToBeConverted()
Convert all properties in the source array
public
getSourceChildPropertiesToBeConverted(mixed $source) : array<string|int, mixed>
Parameters
- $source : mixed
only to be used within Extbase, not part of TYPO3 Core API.
Return values
array<string|int, mixed>getSupportedSourceTypes()
Returns the list of source types the TypeConverter can handle.
public
getSupportedSourceTypes() : array<string|int, string>
Must be PHP simple types, classes or object is not allowed.
Return values
array<string|int, string>getSupportedTargetType()
Return the target type this TypeConverter converts to.
public
getSupportedTargetType() : string
Can be a simple type or a class name.
Return values
stringgetTargetTypeForSource()
Determines the target type based on the source's (optional) __type key.
public
getTargetTypeForSource(mixed $source, string $originalTargetType[, PropertyMappingConfigurationInterface $configuration = null ]) : string
Parameters
- $source : mixed
- $originalTargetType : string
- $configuration : PropertyMappingConfigurationInterface = null
only to be used within Extbase, not part of TYPO3 Core API.
Tags
Return values
stringgetTypeOfChildProperty()
The type of a property is determined by the reflection service.
public
getTypeOfChildProperty(string $targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration) : string
Parameters
- $targetType : string
- $propertyName : string
- $configuration : PropertyMappingConfigurationInterface
only to be used within Extbase, not part of TYPO3 Core API.
Tags
Return values
stringinjectContainer()
public
injectContainer(ContainerInterface $container) : mixed
Parameters
- $container : ContainerInterface
injectObjectContainer()
public
injectObjectContainer(Container $objectContainer) : void
since v11, will be removed in v12.
Parameters
- $objectContainer : Container
injectObjectManager()
public
injectObjectManager(ObjectManagerInterface $objectManager) : void
since v11, will be removed in v12
Parameters
- $objectManager : ObjectManagerInterface
only to be used within Extbase, not part of TYPO3 Core API.
injectReflectionService()
public
injectReflectionService(ReflectionService $reflectionService) : void
Parameters
- $reflectionService : ReflectionService
buildObject()
Builds a new instance of $objectType with the given $possibleConstructorArgumentValues. If constructor argument values are missing from the given array the method looks for a default value in the constructor signature. Furthermore, the constructor arguments are removed from $possibleConstructorArgumentValues: They are considered "handled" by __construct and will not be mapped calling setters later.
protected
buildObject(array<string|int, mixed> &$possibleConstructorArgumentValues, string $objectType) : object
Parameters
- $possibleConstructorArgumentValues : array<string|int, mixed>
- $objectType : string
Tags
Return values
object —The created instance