PHP Class Neos\Flow\Property\PropertyMappingConfiguration

Inheritance: implements Neos\Flow\Property\PropertyMappingConfigurationInterface
显示文件 Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$configuration array 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
$mapUnknownProperties boolean If TRUE, unknown properties will be mapped.
$mapping array Keys which should be renamed
$propertiesNotToBeMapped array List of disallowed property names which will be ignored while property mapping
$propertiesToBeMapped array List of allowed property names to be converted
$propertiesToSkip array List of property names to be skipped during property mapping
$skipUnknownProperties boolean If TRUE, unknown properties will be skipped during property mapping
$subConfigurationForProperty array Stores the configuration for specific child properties.
$typeConverter Neos\Flow\Property\TypeConverterInterface

Public Methods

Method Description
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).
allowProperties ( ) : PropertyMappingConfiguration Allow a list of specific properties. All arguments of allowProperties are used here (varargs).
forProperty ( string $propertyPath ) : 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 ( string $propertyName ) : Neos\Flow\Property\PropertyMappingConfigurationInterface Returns the sub-configuration for the passed $propertyName. Must ALWAYS return a valid configuration object!
getConfigurationValue ( string $typeConverterClassName, string $key ) : mixed
getTargetPropertyName ( string $sourcePropertyName ) : string Maps the given $sourcePropertyName to a target property name.
getTypeConverter ( ) : Neos\Flow\Property\TypeConverterInterface Return the type converter set for this configuration.
setMapping ( string $sourcePropertyName, string $targetPropertyName ) : PropertyMappingConfiguration Define renaming from Source to Target property.
setTypeConverter ( Neos\Flow\Property\TypeConverterInterface $typeConverter ) : PropertyMappingConfiguration Set a type converter which should be used for this specific conversion.
setTypeConverterOption ( string $typeConverter, string $optionKey, mixed $optionValue ) : PropertyMappingConfiguration Set a single option (denoted by $optionKey) for the given $typeConverter.
setTypeConverterOptions ( string $typeConverter, array $options ) : PropertyMappingConfiguration Set all options for the given $typeConverter.
shouldMap ( string $propertyName ) : boolean The behavior is as follows:
shouldSkip ( string $propertyName ) : boolean Check if the given $propertyName should be skipped during mapping.
shouldSkipUnknownProperties ( ) : boolean 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 ( array $splittedPropertyPath ) : PropertyMappingConfiguration Traverse the property configuration. Only used by forProperty().

Protected Methods

Method Description
getTypeConvertersWithParentClasses ( string $typeConverter ) : array Get type converter classes including parents for the given type converter

Method Details

allowAllProperties() public method

Allow all properties in property mapping, even unknown ones.
public allowAllProperties ( ) : PropertyMappingConfiguration
return PropertyMappingConfiguration this

allowAllPropertiesExcept() public method

Example: allowAllPropertiesExcept('password', 'userGroup')
public allowAllPropertiesExcept ( ) : PropertyMappingConfiguration
return PropertyMappingConfiguration this

allowProperties() public method

Example: allowProperties('title', 'content', 'author')
public allowProperties ( ) : PropertyMappingConfiguration
return PropertyMappingConfiguration this

forProperty() public method

...)
public forProperty ( string $propertyPath ) : PropertyMappingConfiguration
$propertyPath string
return PropertyMappingConfiguration (or a subclass thereof)

getConfigurationFor() public method

Returns the sub-configuration for the passed $propertyName. Must ALWAYS return a valid configuration object!
public getConfigurationFor ( string $propertyName ) : Neos\Flow\Property\PropertyMappingConfigurationInterface
$propertyName string
return Neos\Flow\Property\PropertyMappingConfigurationInterface the property mapping configuration for the given $propertyName.

getConfigurationValue() public method

public getConfigurationValue ( string $typeConverterClassName, string $key ) : mixed
$typeConverterClassName string
$key string
return mixed configuration value for the specific $typeConverterClassName. Can be used by Type Converters to fetch converter-specific configuration.

getTargetPropertyName() public method

Maps the given $sourcePropertyName to a target property name.
public getTargetPropertyName ( string $sourcePropertyName ) : string
$sourcePropertyName string
return string property name of target

getTypeConverter() public method

Return the type converter set for this configuration.
public getTypeConverter ( ) : Neos\Flow\Property\TypeConverterInterface
return Neos\Flow\Property\TypeConverterInterface

getTypeConvertersWithParentClasses() protected method

When setting an option on a subclassed type converter, this option must also be set on all its parent type converters.
protected getTypeConvertersWithParentClasses ( string $typeConverter ) : array
$typeConverter string The type converter class
return array Class names of type converters

setMapping() public method

Define renaming from Source to Target property.
public setMapping ( string $sourcePropertyName, string $targetPropertyName ) : PropertyMappingConfiguration
$sourcePropertyName string
$targetPropertyName string
return PropertyMappingConfiguration this

setTypeConverter() public method

Set a type converter which should be used for this specific conversion.
public setTypeConverter ( Neos\Flow\Property\TypeConverterInterface $typeConverter ) : PropertyMappingConfiguration
$typeConverter Neos\Flow\Property\TypeConverterInterface
return PropertyMappingConfiguration this

setTypeConverterOption() public method

Set a single option (denoted by $optionKey) for the given $typeConverter.
public setTypeConverterOption ( string $typeConverter, string $optionKey, mixed $optionValue ) : PropertyMappingConfiguration
$typeConverter string class name of type converter
$optionKey string
$optionValue mixed
return PropertyMappingConfiguration this

setTypeConverterOptions() public method

Set all options for the given $typeConverter.
public setTypeConverterOptions ( string $typeConverter, array $options ) : PropertyMappingConfiguration
$typeConverter string class name of type converter
$options array
return PropertyMappingConfiguration this

shouldMap() public method

- 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.
public shouldMap ( string $propertyName ) : boolean
$propertyName string
return boolean TRUE if the given propertyName should be mapped, FALSE otherwise.

shouldSkip() public method

Check if the given $propertyName should be skipped during mapping.
public shouldSkip ( string $propertyName ) : boolean
$propertyName string
return boolean

shouldSkipUnknownProperties() public method

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

skipProperties() public method

Example: skipProperties('unused', 'dummy')
public skipProperties ( ) : PropertyMappingConfiguration
return PropertyMappingConfiguration this

skipUnknownProperties() public method

When this is enabled, properties that are disallowed will be skipped instead of triggering an error during mapping.
public skipUnknownProperties ( ) : PropertyMappingConfiguration
return PropertyMappingConfiguration this

traverseProperties() public method

Traverse the property configuration. Only used by forProperty().
public traverseProperties ( array $splittedPropertyPath ) : PropertyMappingConfiguration
$splittedPropertyPath array
return PropertyMappingConfiguration (or a subclass thereof)

Property Details

$configuration protected_oe property

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 $configuration
return array

$mapUnknownProperties protected_oe property

If TRUE, unknown properties will be mapped.
protected bool $mapUnknownProperties
return boolean

$mapping protected_oe property

Keys which should be renamed
protected array $mapping
return array

$propertiesNotToBeMapped protected_oe property

List of disallowed property names which will be ignored while property mapping
protected array $propertiesNotToBeMapped
return array

$propertiesToBeMapped protected_oe property

List of allowed property names to be converted
protected array $propertiesToBeMapped
return array

$propertiesToSkip protected_oe property

List of property names to be skipped during property mapping
protected array $propertiesToSkip
return array

$skipUnknownProperties protected_oe property

If TRUE, unknown properties will be skipped during property mapping
protected bool $skipUnknownProperties
return boolean

$subConfigurationForProperty protected_oe property

Stores the configuration for specific child properties.
protected array $subConfigurationForProperty
return array

$typeConverter protected_oe property

protected TypeConverterInterface,Neos\Flow\Property $typeConverter
return Neos\Flow\Property\TypeConverterInterface