‪TYPO3CMS  ‪main
TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter:
TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter TYPO3\CMS\Extbase\Property\TypeConverterInterface TYPO3\CMS\Core\SingletonInterface TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter

Public Member Functions

 injectReflectionService (ReflectionService $reflectionService)
 
 injectContainer (ContainerInterface $container)
 
 getSourceChildPropertiesToBeConverted ($source)
 
 getTypeOfChildProperty (string $targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration)
 
object null convertFrom ( $source, string $targetType, array $convertedChildProperties=[], ?PropertyMappingConfigurationInterface $configuration=null)
 
 getTargetTypeForSource ( $source, string $originalTargetType, ?PropertyMappingConfigurationInterface $configuration=null)
 

Public Attributes

const CONFIGURATION_TARGET_TYPE = 3
 
const CONFIGURATION_OVERRIDE_TARGET_TYPE_ALLOWED = 4
 

Protected Member Functions

object buildObject (array &$possibleConstructorArgumentValues, string $objectType)
 

Protected Attributes

ContainerInterface $container
 
ReflectionService $reflectionService
 

Detailed Description

This converter transforms arrays to simple objects (POPO) by setting properties.

Definition at line 35 of file ObjectConverter.php.

Member Function Documentation

◆ buildObject()

object TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::buildObject ( array &  $possibleConstructorArgumentValues,
string  $objectType 
)
protected

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.

Returns
‪object The created instance
Exceptions
InvalidTargetException‪if a required constructor argument is missing

Definition at line 212 of file ObjectConverter.php.

Referenced by TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter\convertFrom(), and TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter\handleArrayData().

◆ convertFrom()

object null TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::convertFrom (   $source,
string  $targetType,
array  $convertedChildProperties = [],
?PropertyMappingConfigurationInterface  $configuration = null 
)

Convert an object from $source to an object.

Parameters
mixed$source
Returns
‪object|null the target type
Exceptions
InvalidTargetException

only to be used within Extbase, not part of TYPO3 Core API.

Implements TYPO3\CMS\Extbase\Property\TypeConverterInterface.

Reimplemented in TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter.

Definition at line 142 of file ObjectConverter.php.

References TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter\buildObject(), and TYPO3\CMS\Extbase\Reflection\ObjectAccess\setProperty().

◆ getSourceChildPropertiesToBeConverted()

TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::getSourceChildPropertiesToBeConverted (   $source)

Convert all properties in the source array

Parameters
mixed$source

only to be used within Extbase, not part of TYPO3 Core API.

Reimplemented from TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter.

Reimplemented in TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter.

Definition at line 67 of file ObjectConverter.php.

◆ getTargetTypeForSource()

TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::getTargetTypeForSource (   $source,
string  $originalTargetType,
?PropertyMappingConfigurationInterface  $configuration = null 
)

Determines the target type based on the source's (optional) __type key and by evaluating possible XCLASS overrides of the target type.

Parameters
mixed$source
Exceptions
InvalidDataTypeException
InvalidPropertyMappingConfigurationException

Reimplemented from TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter.

Definition at line 175 of file ObjectConverter.php.

◆ getTypeOfChildProperty()

TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::getTypeOfChildProperty ( string  $targetType,
string  $propertyName,
PropertyMappingConfigurationInterface  $configuration 
)

The type of a property is determined by the reflection service.

Exceptions
InvalidTargetException

only to be used within Extbase, not part of TYPO3 Core API.

Reimplemented from TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter.

Definition at line 81 of file ObjectConverter.php.

References TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface\getConfigurationFor(), and TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface\getConfigurationValue().

◆ injectContainer()

TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::injectContainer ( ContainerInterface  $container)

◆ injectReflectionService()

TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::injectReflectionService ( ReflectionService  $reflectionService)

Member Data Documentation

◆ $container

ContainerInterface TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::$container
protected

◆ $reflectionService

ReflectionService TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::$reflectionService
protected

◆ CONFIGURATION_OVERRIDE_TARGET_TYPE_ALLOWED

◆ CONFIGURATION_TARGET_TYPE