PHP Class Neos\Flow\Property\PropertyMapper

It is used most prominently to map incoming HTTP arguments to objects.
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Method Details

buildPropertyMappingConfiguration() public méthode

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
Résultat PropertyMappingConfiguration

convert() public méthode

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.
Résultat mixed an instance of $targetType

determineSourceTypes() protected méthode

Determine the type of the source data, or throw an exception if source was an unsupported format.
protected determineSourceTypes ( mixed $source ) : array
$source mixed
Résultat array Possible source types (single value for simple typed source, multiple values for object source)

doMapping() protected méthode

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.
Résultat mixed an instance of $targetType

findEligibleConverterWithHighestPriority() protected méthode

protected findEligibleConverterWithHighestPriority ( mixed $converters, mixed $source, string $targetType ) : mixed
$converters mixed
$source mixed
$targetType string
Résultat mixed Either the matching object converter or NULL

findFirstEligibleTypeConverterInObjectHierarchy() protected méthode

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
Résultat mixed Either the matching object converter or NULL

findTypeConverter() protected méthode

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
Résultat Neos\Flow\Property\TypeConverterInterface Type Converter which should be used to convert between $source and $targetType.

getConvertersForInterfaces() protected méthode

protected getConvertersForInterfaces ( array $convertersForSource, array $interfaceNames ) : array
$convertersForSource array
$interfaceNames array
Résultat array

getMessages() public méthode

Get the messages of the last Property Mapping
public getMessages ( ) : Neos\Error\Messages\Result
Résultat Neos\Error\Messages\Result

getTypeConverterImplementationClassNames() public static méthode

Returns all class names implementing the TypeConverterInterface.
public static getTypeConverterImplementationClassNames ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : array
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
Résultat array Array of type converter implementations

getTypeConverters() public méthode

It has the following structure: 1. Dimension: Source Type 2. Dimension: Target Type 3. Dimension: Priority Value: Type Converter instance
public getTypeConverters ( ) : array
Résultat array

initializeObject() public méthode

Here, the typeConverter array gets initialized.
public initializeObject ( ) : void
Résultat void

prepareTypeConverterMap() protected méthode

Collects all TypeConverter implementations in a multi-dimensional array with source and target types.
See also: getTypeConverters
protected prepareTypeConverterMap ( ) : array
Résultat array

Property Details

$cache protected_oe property

protected VariableFrontend,Neos\Cache\Frontend $cache
Résultat Neos\Cache\Frontend\VariableFrontend

$messages protected_oe property

A list of property mapping messages (errors, warnings) which have occured on last mapping.
protected Result,Neos\Error\Messages $messages
Résultat Neos\Error\Messages\Result

$objectManager protected_oe property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
Résultat Neos\Flow\ObjectManagement\ObjectManagerInterface

$typeConverters protected_oe property

It has the following structure: 1. Dimension: Source Type 2. Dimension: Target Type 3. Dimension: Priority Value: Type Converter instance
protected array $typeConverters
Résultat array