TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Property\PropertyMapper Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Property\PropertyMapper:
TYPO3\CMS\Core\SingletonInterface Tx_Extbase_Property_PropertyMapper

Public Member Functions

 initializeObject ()
 
 convert ($source, $targetType, \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration=NULL)
 
 getMessages ()
 
 parseCompositeType ($compositeType)
 

Protected Member Functions

 doMapping ($source, $targetType, \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration, &$currentPropertyPath)
 
 findTypeConverter ($source, $targetType, \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration)
 
 findFirstEligibleTypeConverterInObjectHierarchy ($source, $sourceType, $targetClass)
 
 findEligibleConverterWithHighestPriority ($converters, $source, $targetType)
 
 getConvertersForInterfaces (array $convertersForSource, array $interfaceNames)
 
 determineSourceType ($source)
 

Protected Attributes

 $objectManager
 
 $configurationBuilder
 
 $typeConverters = array()
 
 $messages
 

Detailed Description

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.

http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later

Definition at line 34 of file PropertyMapper.php.

Member Function Documentation

◆ convert()

TYPO3\CMS\Extbase\Property\PropertyMapper::convert (   $source,
  $targetType,
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface  $configuration = NULL 
)

Map $source to $targetType, and return the result

Parameters
mixed$sourcethe source data to map. MUST be a simple type, NO object allowed!
string$targetTypeThe type of the target; can be either a class name or a simple type.
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface$configurationConfiguration for the property mapping. If NULL, the PropertyMappingConfigurationBuilder will create a default configuration.
Exceptions
Exception
Returns
mixed an instance of $targetType

Definition at line 96 of file PropertyMapper.php.

References $result, and TYPO3\CMS\Extbase\Property\PropertyMapper\doMapping().

◆ determineSourceType()

TYPO3\CMS\Extbase\Property\PropertyMapper::determineSourceType (   $source)
protected

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

Parameters
mixed$source
Exceptions
Exception

Definition at line 332 of file PropertyMapper.php.

◆ doMapping()

TYPO3\CMS\Extbase\Property\PropertyMapper::doMapping (   $source,
  $targetType,
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface  $configuration,
$currentPropertyPath 
)
protected

Internal function which actually does the property mapping.

Parameters
mixed$sourcethe source data to map. MUST be a simple type, NO object allowed!
string$targetTypeThe type of the target; can be either a class name or a simple type.
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface$configurationConfiguration for the property mapping.
array&$currentPropertyPathThe property path currently being mapped; used for knowing the context in case an exception is thrown.
Exceptions
Exception

Definition at line 136 of file PropertyMapper.php.

References TYPO3\CMS\Extbase\Property\PropertyMapper\findTypeConverter(), and TYPO3\CMS\Extbase\Property\PropertyMapper\parseCompositeType().

Referenced by TYPO3\CMS\Extbase\Property\PropertyMapper\convert().

◆ findEligibleConverterWithHighestPriority()

TYPO3\CMS\Extbase\Property\PropertyMapper::findEligibleConverterWithHighestPriority (   $converters,
  $source,
  $targetType 
)
protected
Parameters
mixed$converters
mixed$source
string$targetType
Returns
mixed Either the matching object converter or NULL

Definition at line 290 of file PropertyMapper.php.

◆ findFirstEligibleTypeConverterInObjectHierarchy()

TYPO3\CMS\Extbase\Property\PropertyMapper::findFirstEligibleTypeConverterInObjectHierarchy (   $source,
  $sourceType,
  $targetClass 
)
protected

Tries to find a suitable type converter for the given source and target type.

Parameters
string$sourceThe actual source value
string$sourceTypeType of the source to convert from
string$targetClassName of the target class to find a type converter for
Returns
mixed Either the matching object converter or NULL
Exceptions
Exception

Definition at line 243 of file PropertyMapper.php.

◆ findTypeConverter()

TYPO3\CMS\Extbase\Property\PropertyMapper::findTypeConverter (   $source,
  $targetType,
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface  $configuration 
)
protected

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

Parameters
mixed$source
string$targetType
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface$configuration
Exceptions
Exception

Definition at line 199 of file PropertyMapper.php.

Referenced by TYPO3\CMS\Extbase\Property\PropertyMapper\doMapping().

◆ getConvertersForInterfaces()

TYPO3\CMS\Extbase\Property\PropertyMapper::getConvertersForInterfaces ( array  $convertersForSource,
array  $interfaceNames 
)
protected
Parameters
array$convertersForSource
array$interfaceNames
Returns
array
Exceptions
Exception

Definition at line 310 of file PropertyMapper.php.

◆ getMessages()

TYPO3\CMS\Extbase\Property\PropertyMapper::getMessages ( )

Get the messages of the last Property Mapping

Returns

Definition at line 122 of file PropertyMapper.php.

References TYPO3\CMS\Extbase\Property\PropertyMapper\$messages.

◆ initializeObject()

TYPO3\CMS\Extbase\Property\PropertyMapper::initializeObject ( )

Lifecycle method, called after all dependencies have been injected. Here, the typeConverter array gets initialized.

Exceptions
Exception

Definition at line 74 of file PropertyMapper.php.

References $GLOBALS.

◆ parseCompositeType()

TYPO3\CMS\Extbase\Property\PropertyMapper::parseCompositeType (   $compositeType)

Parse a composite type like <> into

Parameters
string$compositeType
Returns
string

Definition at line 355 of file PropertyMapper.php.

Referenced by TYPO3\CMS\Extbase\Property\PropertyMapper\doMapping().

Member Data Documentation

◆ $configurationBuilder

TYPO3\CMS\Extbase\Property\PropertyMapper::$configurationBuilder
protected

Definition at line 46 of file PropertyMapper.php.

◆ $messages

TYPO3\CMS\Extbase\Property\PropertyMapper::$messages
protected

◆ $objectManager

TYPO3\CMS\Extbase\Property\PropertyMapper::$objectManager
protected

Definition at line 40 of file PropertyMapper.php.

◆ $typeConverters

TYPO3\CMS\Extbase\Property\PropertyMapper::$typeConverters = array()
protected

Definition at line 58 of file PropertyMapper.php.