class TypedArrayConverter extends AbstractTypeConverter (View source)

Converter which recursively transforms typed arrays (array).

This is a meta converter that will take an array and try to transform all elements in that array to the element type of the target array using an available type converter.

Properties

protected string[] $sourceTypes
protected string $targetType
protected int $priority

Methods

string[]
getSupportedSourceTypes()

Returns the list of source types the TypeConverter can handle.

string
getSupportedTargetType()

Return the target type this TypeConverter converts to.

string
getTargetTypeForSource(mixed $source, string $originalTargetType, PropertyMappingConfigurationInterface $configuration = null)

Returns the $originalTargetType unchanged in this implementation.

int
getPriority()

Return the priority of this TypeConverter. TypeConverters with a high priority are chosen before low priority.

bool
canConvertFrom(mixed $source, string $targetType)

No description

array
getSourceChildPropertiesToBeConverted(mixed $source)

Returns the source, if it is an array, otherwise an empty array.

string
getTypeOfChildProperty(string $targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration)

Return the type of a given sub-property inside the $targetType

mixed|null|Error
convertFrom(mixed $source, string $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)

No description

Details

string[] getSupportedSourceTypes()

Returns the list of source types the TypeConverter can handle.

Must be PHP simple types, classes or object is not allowed.

Return Value

string[]

string getSupportedTargetType()

Return the target type this TypeConverter converts to.

Can be a simple type or a class name.

Return Value

string

string getTargetTypeForSource(mixed $source, string $originalTargetType, PropertyMappingConfigurationInterface $configuration = null)

Returns the $originalTargetType unchanged in this implementation.

Parameters

mixed $source

the source data

string $originalTargetType

the type we originally want to convert to

PropertyMappingConfigurationInterface $configuration

Return Value

string

int getPriority()

Return the priority of this TypeConverter. TypeConverters with a high priority are chosen before low priority.

Return Value

int

bool canConvertFrom(mixed $source, string $targetType)

No description

Parameters

mixed $source

the source data

string $targetType

the type to convert to.

Return Value

bool

true if this TypeConverter can convert from $source to $targetType, false otherwise.

array getSourceChildPropertiesToBeConverted(mixed $source)

Returns the source, if it is an array, otherwise an empty array.

Parameters

mixed $source

Return Value

array

string getTypeOfChildProperty(string $targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration)

Return the type of a given sub-property inside the $targetType

Parameters

string $targetType
string $propertyName
PropertyMappingConfigurationInterface $configuration

Return Value

string

the type of $propertyName in $targetType

mixed|null|Error convertFrom(mixed $source, string $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)

No description

Parameters

mixed $source
string $targetType
array $convertedChildProperties
PropertyMappingConfigurationInterface $configuration

Return Value

mixed|null|Error

the target type, or an error object if a user-error occurred