PHP Класс Neos\Flow\Property\PropertyMapper

It is used most prominently to map incoming HTTP arguments to objects.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cache Neos\Cache\Frontend\VariableFrontend
$messages Neos\Error\Messages\Result A list of property mapping messages (errors, warnings) which have occured on last mapping.
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$typeConverters array It has the following structure: 1. Dimension: Source Type 2. Dimension: Target Type 3. Dimension: Priority Value: Type Converter instance

Открытые методы

Метод Описание
buildPropertyMappingConfiguration ( string $type = PropertyMappingConfiguration::class ) : PropertyMappingConfiguration Builds the default property mapping configuration.
convert ( mixed $source, string $targetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : mixed Map $source to $targetType, and return the result.
getMessages ( ) : Neos\Error\Messages\Result Get the messages of the last Property Mapping
getTypeConverterImplementationClassNames ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : array Returns all class names implementing the TypeConverterInterface.
getTypeConverters ( ) : array Returns a multi-dimensional array with the Type Converters available in the system.
initializeObject ( ) : void Lifecycle method, called after all dependencies have been injected.

Защищенные методы

Метод Описание
determineSourceTypes ( mixed $source ) : array Determine the type of the source data, or throw an exception if source was an unsupported format.
doMapping ( mixed $source, string $targetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration, array &$currentPropertyPath ) : mixed Internal function which actually does the property mapping.
findEligibleConverterWithHighestPriority ( mixed $converters, mixed $source, string $targetType ) : mixed
findFirstEligibleTypeConverterInObjectHierarchy ( string $source, string $sourceType, string $targetType ) : mixed Tries to find a suitable type converter for the given source and target type.
findTypeConverter ( mixed $source, string $targetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration ) : Neos\Flow\Property\TypeConverterInterface Determine the type converter to be used. If no converter has been found, an exception is raised.
getConvertersForInterfaces ( array $convertersForSource, array $interfaceNames ) : array
prepareTypeConverterMap ( ) : array Collects all TypeConverter implementations in a multi-dimensional array with source and target types.

Описание методов

buildPropertyMappingConfiguration() публичный Метод

Builds the default property mapping configuration.
public buildPropertyMappingConfiguration ( string $type = PropertyMappingConfiguration::class ) : PropertyMappingConfiguration
$type string the implementation class name of the PropertyMappingConfiguration to instantiate; must be a subclass of Neos\Flow\Property\PropertyMappingConfiguration
Результат PropertyMappingConfiguration

convert() публичный Метод

If $source is an object and already is of type $targetType, we do return the unmodified object.
public convert ( mixed $source, string $targetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : mixed
$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 Neos\Flow\Property\PropertyMappingConfigurationInterface Configuration for the property mapping. If NULL, the PropertyMappingConfigurationBuilder will create a default configuration.
Результат mixed an instance of $targetType

determineSourceTypes() защищенный Метод

Determine the type of the source data, or throw an exception if source was an unsupported format.
protected determineSourceTypes ( mixed $source ) : array
$source mixed
Результат array Possible source types (single value for simple typed source, multiple values for object source)

doMapping() защищенный Метод

Internal function which actually does the property mapping.
protected doMapping ( mixed $source, string $targetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration, array &$currentPropertyPath ) : mixed
$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 Neos\Flow\Property\PropertyMappingConfigurationInterface Configuration for the property mapping.
$currentPropertyPath array The property path currently being mapped; used for knowing the context in case an exception is thrown.
Результат mixed an instance of $targetType

findEligibleConverterWithHighestPriority() защищенный Метод

protected findEligibleConverterWithHighestPriority ( mixed $converters, mixed $source, string $targetType ) : mixed
$converters mixed
$source mixed
$targetType string
Результат mixed Either the matching object converter or NULL

findFirstEligibleTypeConverterInObjectHierarchy() защищенный Метод

Tries to find a suitable type converter for the given source and target type.
protected findFirstEligibleTypeConverterInObjectHierarchy ( string $source, string $sourceType, string $targetType ) : mixed
$source string The actual source value
$sourceType string Type of the source to convert from
$targetType string Name of the target type to find a type converter for
Результат mixed Either the matching object converter or NULL

findTypeConverter() защищенный Метод

Determine the type converter to be used. If no converter has been found, an exception is raised.
protected findTypeConverter ( mixed $source, string $targetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration ) : Neos\Flow\Property\TypeConverterInterface
$source mixed
$targetType string
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
Результат Neos\Flow\Property\TypeConverterInterface Type Converter which should be used to convert between $source and $targetType.

getConvertersForInterfaces() защищенный Метод

protected getConvertersForInterfaces ( array $convertersForSource, array $interfaceNames ) : array
$convertersForSource array
$interfaceNames array
Результат array

getMessages() публичный Метод

Get the messages of the last Property Mapping
public getMessages ( ) : Neos\Error\Messages\Result
Результат Neos\Error\Messages\Result

getTypeConverterImplementationClassNames() публичный статический Метод

Returns all class names implementing the TypeConverterInterface.
public static getTypeConverterImplementationClassNames ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : array
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
Результат array Array of type converter implementations

getTypeConverters() публичный Метод

It has the following structure: 1. Dimension: Source Type 2. Dimension: Target Type 3. Dimension: Priority Value: Type Converter instance
public getTypeConverters ( ) : array
Результат array

initializeObject() публичный Метод

Here, the typeConverter array gets initialized.
public initializeObject ( ) : void
Результат void

prepareTypeConverterMap() защищенный Метод

Collects all TypeConverter implementations in a multi-dimensional array with source and target types.
См. также: getTypeConverters
protected prepareTypeConverterMap ( ) : array
Результат array

Описание свойств

$cache защищенное свойство

protected VariableFrontend,Neos\Cache\Frontend $cache
Результат Neos\Cache\Frontend\VariableFrontend

$messages защищенное свойство

A list of property mapping messages (errors, warnings) which have occured on last mapping.
protected Result,Neos\Error\Messages $messages
Результат Neos\Error\Messages\Result

$objectManager защищенное свойство

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
Результат Neos\Flow\ObjectManagement\ObjectManagerInterface

$typeConverters защищенное свойство

It has the following structure: 1. Dimension: Source Type 2. Dimension: Target Type 3. Dimension: Priority Value: Type Converter instance
protected array $typeConverters
Результат array