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

Public Member Functions

 injectPersistenceManager (PersistenceManagerInterface $persistenceManager)
 
 getSourceChildPropertiesToBeConverted ($source)
 
 getTypeOfChildProperty ($targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration)
 
object null convertFrom ($source, string $targetType, array $convertedChildProperties=[], PropertyMappingConfigurationInterface $configuration=null)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter
 injectReflectionService (ReflectionService $reflectionService)
 
 injectContainer (ContainerInterface $container)
 
 getTypeOfChildProperty (string $targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration)
 
 getTargetTypeForSource ($source, string $originalTargetType, PropertyMappingConfigurationInterface $configuration=null)
 

Public Attributes

const CONFIGURATION_MODIFICATION_ALLOWED = 1
 
const CONFIGURATION_CREATION_ALLOWED = 2
 
- ‪Public Attributes inherited from ‪TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter
const CONFIGURATION_TARGET_TYPE = 3
 
const CONFIGURATION_OVERRIDE_TARGET_TYPE_ALLOWED = 4
 

Protected Member Functions

 handleArrayData (array $source, string $targetType, array &$convertedChildProperties, PropertyMappingConfigurationInterface $configuration=null)
 
 fetchObjectFromPersistence ($identity, string $targetType)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter
object buildObject (array &$possibleConstructorArgumentValues, string $objectType)
 

Protected Attributes

TYPO3 CMS Extbase Persistence PersistenceManagerInterface $persistenceManager
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter
ContainerInterface $container
 
TYPO3 CMS Extbase Reflection ReflectionService $reflectionService
 

Detailed Description

This converter transforms arrays or strings to persistent objects. It does the following:

  • ‪If the input is string, it is assumed to be a UID. Then, the object is fetched from persistence.
  • ‪If the input is array, we check if it has an identity property.
  • ‪If the input has an identity property and NO additional properties, we fetch the object from persistence.
  • ‪If the input has an identity property AND additional properties, we fetch the object from persistence, and set the sub-properties. We only do this if the configuration option "CONFIGURATION_MODIFICATION_ALLOWED" is TRUE.
  • ‪If the input has NO identity property, but additional properties, we create a new object and return it. However, we only do this if the configuration option "CONFIGURATION_CREATION_ALLOWED" is TRUE.

Definition at line 43 of file PersistentObjectConverter.php.

Member Function Documentation

◆ convertFrom()

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

◆ fetchObjectFromPersistence()

TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::fetchObjectFromPersistence (   $identity,
string  $targetType 
)
protected

◆ getSourceChildPropertiesToBeConverted()

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

All properties in the source array except __identity are sub-properties.

Parameters
mixed$source

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

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

Definition at line 73 of file PersistentObjectConverter.php.

◆ getTypeOfChildProperty()

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

◆ handleArrayData()

TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::handleArrayData ( array  $source,
string  $targetType,
array &  $convertedChildProperties,
PropertyMappingConfigurationInterface  $configuration = null 
)
protected

◆ injectPersistenceManager()

TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::injectPersistenceManager ( PersistenceManagerInterface  $persistenceManager)

Member Data Documentation

◆ $persistenceManager

TYPO3 CMS Extbase Persistence PersistenceManagerInterface TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::$persistenceManager
protected

◆ CONFIGURATION_CREATION_ALLOWED

◆ CONFIGURATION_MODIFICATION_ALLOWED