MvcPropertyMappingConfiguration extends PropertyMappingConfiguration

The default property mapping configuration is available inside the Argument-object.

Table of Contents

Constants

PROPERTY_PATH_PLACEHOLDER  = '*'
Placeholder in property paths for multi-valued types

Properties

$configuration  : array<string|int, mixed>
multi-dimensional array which stores type-converter specific configuration: 1. Dimension: Fully qualified class name of the type converter 2. Dimension: Configuration Key Value: Configuration Value
$mapping  : array<string|int, mixed>
Keys which should be renamed
$mapUnknownProperties  : bool
If TRUE, unknown properties will be mapped.
$propertiesNotToBeMapped  : array<string|int, mixed>
List of disallowed property names which will be ignored while property mapping
$propertiesToBeMapped  : array<string|int, mixed>
List of allowed property names to be converted
$propertiesToSkip  : array<string|int, mixed>
List of property names to be skipped during property mapping
$skipUnknownProperties  : bool
If TRUE, unknown properties will be skipped during property mapping
$subConfigurationForProperty  : array<string|int, PropertyMappingConfigurationInterface>
Stores the configuration for specific child properties.
$typeConverter  : TypeConverterInterface

Methods

allowAllProperties()  : PropertyMappingConfiguration
Allow all properties in property mapping, even unknown ones.
allowAllPropertiesExcept()  : PropertyMappingConfiguration
Allow all properties during property mapping, but reject a few selected ones (blacklist).
allowCreationForSubProperty()  : mixed
Allow creation of a certain sub property
allowModificationForSubProperty()  : mixed
Allow modification for a given property path
allowProperties()  : PropertyMappingConfiguration
Allow a list of specific properties. All arguments of allowProperties are used here (varargs).
forProperty()  : PropertyMappingConfiguration
Returns the configuration for the specific property path, ready to be modified. Should be used inside a fluent interface like: $configuration->forProperty('foo.bar')->setTypeConverterOption(....)
getConfigurationFor()  : PropertyMappingConfigurationInterface
Returns the sub-configuration for the passed $propertyName. Must ALWAYS return a valid configuration object!
getConfigurationValue()  : mixed
getTargetPropertyName()  : string
Maps the given $sourcePropertyName to a target property name.
getTypeConverter()  : TypeConverterInterface|null
Return the type converter set for this configuration.
setMapping()  : PropertyMappingConfiguration
Define renaming from Source to Target property.
setTargetTypeForSubProperty()  : mixed
Set the target type for a certain property. Especially useful if there is an object which has a nested object which is abstract, and you want to instantiate a concrete object instead.
setTypeConverter()  : PropertyMappingConfiguration
Set a type converter which should be used for this specific conversion.
setTypeConverterOption()  : PropertyMappingConfiguration
Set a single option (denoted by $optionKey) for the given $typeConverter.
setTypeConverterOptions()  : PropertyMappingConfiguration
Set all options for the given $typeConverter.
shouldMap()  : bool
The behavior is as follows:
shouldSkip()  : bool
Check if the given $propertyName should be skipped during mapping.
shouldSkipUnknownProperties()  : bool
Whether unknown (unconfigured) properties should be skipped during mapping, instead if causing an error.
skipProperties()  : PropertyMappingConfiguration
Skip a list of specific properties. All arguments of skipProperties are used here (varargs).
skipUnknownProperties()  : PropertyMappingConfiguration
When this is enabled, properties that are disallowed will be skipped instead of triggering an error during mapping.
traverseProperties()  : PropertyMappingConfiguration
Traverse the property configuration. Only used by forProperty().
getTypeConvertersWithParentClasses()  : array<string|int, mixed>
Get type converter classes including parents for the given type converter

Constants

PROPERTY_PATH_PLACEHOLDER

Placeholder in property paths for multi-valued types

public mixed PROPERTY_PATH_PLACEHOLDER = '*'

Properties

$configuration

multi-dimensional array which stores type-converter specific configuration: 1. Dimension: Fully qualified class name of the type converter 2. Dimension: Configuration Key Value: Configuration Value

protected array<string|int, mixed> $configuration

$mapping

Keys which should be renamed

protected array<string|int, mixed> $mapping = []

$mapUnknownProperties

If TRUE, unknown properties will be mapped.

protected bool $mapUnknownProperties = false

$propertiesNotToBeMapped

List of disallowed property names which will be ignored while property mapping

protected array<string|int, mixed> $propertiesNotToBeMapped = []

$propertiesToBeMapped

List of allowed property names to be converted

protected array<string|int, mixed> $propertiesToBeMapped = []

$propertiesToSkip

List of property names to be skipped during property mapping

protected array<string|int, mixed> $propertiesToSkip = []

$skipUnknownProperties

If TRUE, unknown properties will be skipped during property mapping

protected bool $skipUnknownProperties = false

Methods

allowCreationForSubProperty()

Allow creation of a certain sub property

public allowCreationForSubProperty(string $propertyPath) : mixed
Parameters
$propertyPath : string

allowModificationForSubProperty()

Allow modification for a given property path

public allowModificationForSubProperty(string $propertyPath) : mixed
Parameters
$propertyPath : string

forProperty()

Returns the configuration for the specific property path, ready to be modified. Should be used inside a fluent interface like: $configuration->forProperty('foo.bar')->setTypeConverterOption(....)

public forProperty(string $propertyPath) : PropertyMappingConfiguration
Parameters
$propertyPath : string
Return values
PropertyMappingConfiguration

(or a subclass thereof)

getConfigurationValue()

public getConfigurationValue(string $typeConverterClassName, string $key) : mixed
Parameters
$typeConverterClassName : string
$key : string
Return values
mixed

configuration value for the specific $typeConverterClassName. Can be used by Type Converters to fetch converter-specific configuration.

getTargetPropertyName()

Maps the given $sourcePropertyName to a target property name.

public getTargetPropertyName(string $sourcePropertyName) : string
Parameters
$sourcePropertyName : string
Return values
string

property name of target

setTargetTypeForSubProperty()

Set the target type for a certain property. Especially useful if there is an object which has a nested object which is abstract, and you want to instantiate a concrete object instead.

public setTargetTypeForSubProperty(string $propertyPath, string $targetType) : mixed
Parameters
$propertyPath : string
$targetType : string

setTypeConverterOption()

Set a single option (denoted by $optionKey) for the given $typeConverter.

public setTypeConverterOption(string $typeConverter, string $optionKey, mixed $optionValue) : PropertyMappingConfiguration
Parameters
$typeConverter : string

class name of type converter

$optionKey : string
$optionValue : mixed
Return values
PropertyMappingConfiguration

this

setTypeConverterOptions()

Set all options for the given $typeConverter.

public setTypeConverterOptions(string $typeConverter, array<string|int, mixed> $options) : PropertyMappingConfiguration
Parameters
$typeConverter : string

class name of type converter

$options : array<string|int, mixed>
Return values
PropertyMappingConfiguration

this

shouldMap()

The behavior is as follows:

public shouldMap(string $propertyName) : bool
  • if a property has been explicitly forbidden using allowAllPropertiesExcept(...), it is directly rejected
  • if a property has been allowed using allowProperties(...), it is directly allowed.
  • if allowAllProperties* has been called, we allow unknown properties
  • else, return FALSE.
Parameters
$propertyName : string
Return values
bool

TRUE if the given propertyName should be mapped, FALSE otherwise.

shouldSkip()

Check if the given $propertyName should be skipped during mapping.

public shouldSkip(string $propertyName) : bool
Parameters
$propertyName : string
Return values
bool

shouldSkipUnknownProperties()

Whether unknown (unconfigured) properties should be skipped during mapping, instead if causing an error.

public shouldSkipUnknownProperties() : bool
Return values
bool

getTypeConvertersWithParentClasses()

Get type converter classes including parents for the given type converter

protected getTypeConvertersWithParentClasses(string $typeConverter) : array<string|int, mixed>

When setting an option on a subclassed type converter, this option must also be set on all its parent type converters.

Parameters
$typeConverter : string

The type converter class

Return values
array<string|int, mixed>

Class names of type converters


        
On this page

Search results