PropertyMapper implements SingletonInterface

The Property Mapper transforms simple types (arrays, strings, integers, floats, booleans) to objects or other simple types.

It is used most prominently to map incoming HTTP arguments to objects.

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$configurationBuilder  : PropertyMappingConfigurationBuilder
$messages  : Result
A list of property mapping messages (errors, warnings) which have occurred on last mapping.
$typeConverterRegistry  : TypeConverterRegistry

Methods

__construct()  : mixed
convert()  : mixed
Map $source to $targetType, and return the result
getMessages()  : Result
Get the messages of the last Property Mapping.
resetMessages()  : void
Resets the messages of the last Property Mapping.
determineSourceType()  : string
Determine the type of the source data, or throw an exception if source was an unsupported format.
doMapping()  : mixed
Internal function which actually does the property mapping.
findTypeConverter()  : TypeConverterInterface
Determine the type converter to be used. If no converter has been found, an exception is raised.
parseCompositeType()  : string
Parse a composite type like \Foo\Collection<\Bar\Entity> into \Foo\Collection

Properties

$messages

A list of property mapping messages (errors, warnings) which have occurred on last mapping.

protected Result $messages

Methods

convert()

Map $source to $targetType, and return the result

public convert(mixed $source, string $targetType[, PropertyMappingConfigurationInterface|null $configuration = null ]) : mixed
Parameters
$source : mixed

the source data to map. MUST be a simple type, NO object allowed!

$targetType : string

The type of the target; can be either a class name or a simple type.

$configuration : PropertyMappingConfigurationInterface|null = null

Configuration for the property mapping. If NULL, the PropertyMappingConfigurationBuilder will create a default configuration.

Tags
throws
Exception
Return values
mixed

an instance of $targetType

getMessages()

Get the messages of the last Property Mapping.

public getMessages() : Result
Return values
Result

resetMessages()

Resets the messages of the last Property Mapping.

public resetMessages() : void

determineSourceType()

Determine the type of the source data, or throw an exception if source was an unsupported format.

protected determineSourceType(mixed $source) : string
Parameters
$source : mixed
Internal

since TYPO3 v12.0

Tags
throws
InvalidSourceException
Return values
string

doMapping()

Internal function which actually does the property mapping.

protected doMapping(mixed $source, string $targetType, PropertyMappingConfigurationInterface $configuration, array<string|int, mixed> &$currentPropertyPath) : mixed
Parameters
$source : mixed

the source data to map. MUST be a simple type, NO object allowed!

$targetType : string

The type of the target; can be either a class name or a simple type.

$configuration : PropertyMappingConfigurationInterface

Configuration for the property mapping.

$currentPropertyPath : array<string|int, mixed>

The property path currently being mapped; used for knowing the context in case an exception is thrown.

Internal

since TYPO3 v12.0

Tags
throws
TypeConverterException
throws
InvalidPropertyMappingConfigurationException
throws
DuplicateTypeConverterException
throws
InvalidPropertyMappingConfigurationException
throws
InvalidSourceException
throws
InvalidTargetException
throws
TypeConverterException
Return values
mixed

an instance of $targetType

findTypeConverter()

Determine the type converter to be used. If no converter has been found, an exception is raised.

protected findTypeConverter(mixed $source, string $targetType, PropertyMappingConfigurationInterface $configuration) : TypeConverterInterface
Parameters
$source : mixed
$targetType : string
$configuration : PropertyMappingConfigurationInterface
Internal

since TYPO3 v12.0

Tags
throws
TypeConverterException
throws
InvalidTargetException
throws
DuplicateTypeConverterException
throws
InvalidSourceException
Return values
TypeConverterInterface

Type Converter which should be used to convert between $source and $targetType.

parseCompositeType()

Parse a composite type like \Foo\Collection<\Bar\Entity> into \Foo\Collection

protected parseCompositeType(string $compositeType) : string
Parameters
$compositeType : string
Internal

since TYPO3 v12.0

Return values
string

        
On this page

Search results