TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
PropertyMappingConfiguration Class Reference
Inheritance diagram for PropertyMappingConfiguration:
PropertyMappingConfigurationInterface MvcPropertyMappingConfiguration

Public Member Functions

 shouldMap ($propertyName)
 
 shouldSkip ($propertyName)
 
 allowAllProperties ()
 
 allowProperties ()
 
 skipProperties ()
 
 allowAllPropertiesExcept ()
 
 skipUnknownProperties ()
 
 shouldSkipUnknownProperties ()
 
 getConfigurationFor ($propertyName)
 
 getTargetPropertyName ($sourcePropertyName)
 
 getConfigurationValue ($typeConverterClassName, $key)
 
 setMapping ($sourcePropertyName, $targetPropertyName)
 
 setTypeConverterOptions ($typeConverter, array $options)
 
 setTypeConverterOption ($typeConverter, $optionKey, $optionValue)
 
 forProperty ($propertyPath)
 
 traverseProperties (array $splittedPropertyPath)
 
 getTypeConverter ()
 
 setTypeConverter (\TYPO3\CMS\Extbase\Property\TypeConverterInterface $typeConverter)
 

Public Attributes

const PROPERTY_PATH_PLACEHOLDER = '*'
 

Protected Member Functions

 getTypeConvertersWithParentClasses ($typeConverter)
 

Protected Attributes

 $configuration
 
 $subConfigurationForProperty = []
 
 $mapping = []
 
 $typeConverter = null
 
 $propertiesToBeMapped = []
 
 $propertiesToSkip = []
 
 $propertiesNotToBeMapped = []
 
 $skipUnknownProperties = false
 
 $mapUnknownProperties = false
 

Detailed Description

Concrete configuration object for the PropertyMapper.

Definition at line 31 of file PropertyMappingConfiguration.php.

Member Function Documentation

allowAllProperties ( )

Allow all properties in property mapping, even unknown ones.

Returns
this

Definition at line 149 of file PropertyMappingConfiguration.php.

allowAllPropertiesExcept ( )

Allow all properties during property mapping, but reject a few selected ones (blacklist).

Example: allowAllPropertiesExcept('password', 'userGroup')

Returns
this

Definition at line 198 of file PropertyMappingConfiguration.php.

allowProperties ( )

Allow a list of specific properties. All arguments of allowProperties are used here (varargs).

Example: allowProperties('title', 'content', 'author')

Returns

Definition at line 164 of file PropertyMappingConfiguration.php.

forProperty (   $propertyPath)

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(....)

Parameters
string$propertyPath
Returns
(or a subclass thereof)

Definition at line 360 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\traverseProperties().

Referenced by MvcPropertyMappingConfiguration\allowCreationForSubProperty(), MvcPropertyMappingConfiguration\allowModificationForSubProperty(), and MvcPropertyMappingConfiguration\setTargetTypeForSubProperty().

getConfigurationFor (   $propertyName)

Returns the sub-configuration for the passed $propertyName. Must ALWAYS return a valid configuration object!

Parameters
string$propertyName
Returns
the property mapping configuration for the given $propertyName.

Implements PropertyMappingConfigurationInterface.

Definition at line 240 of file PropertyMappingConfiguration.php.

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

Implements PropertyMappingConfigurationInterface.

Definition at line 272 of file PropertyMappingConfiguration.php.

getTargetPropertyName (   $sourcePropertyName)

Maps the given $sourcePropertyName to a target property name.

Parameters
string$sourcePropertyName
Returns
string property name of target

Implements PropertyMappingConfigurationInterface.

Definition at line 258 of file PropertyMappingConfiguration.php.

getTypeConverter ( )

Return the type converter set for this configuration.

Returns

Implements PropertyMappingConfigurationInterface.

Definition at line 396 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\$typeConverter.

getTypeConvertersWithParentClasses (   $typeConverter)
protected

Get type converter classes including parents for the given type converter

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

Parameters
string$typeConverterThe type converter class
Returns
array Class names of type converters

Definition at line 343 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\$typeConverter.

Referenced by PropertyMappingConfiguration\setTypeConverterOption(), and PropertyMappingConfiguration\setTypeConverterOptions().

setMapping (   $sourcePropertyName,
  $targetPropertyName 
)

Define renaming from Source to Target property.

Parameters
string$sourcePropertyName
string$targetPropertyName
Returns
this

Definition at line 289 of file PropertyMappingConfiguration.php.

setTypeConverter ( \TYPO3\CMS\Extbase\Property\TypeConverterInterface  $typeConverter)

Set a type converter which should be used for this specific conversion.

Parameters
\TYPO3\CMS\Extbase\Property\TypeConverterInterface$typeConverter
Returns
this

Definition at line 408 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\$typeConverter.

setTypeConverterOption (   $typeConverter,
  $optionKey,
  $optionValue 
)

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

Parameters
string$typeConverterclass name of type converter
string$optionKey
mixed$optionValue
Returns
this

Definition at line 323 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\$typeConverter, ClassLoadingInformation\getClassNameForAlias(), and PropertyMappingConfiguration\getTypeConvertersWithParentClasses().

setTypeConverterOptions (   $typeConverter,
array  $options 
)

Set all options for the given $typeConverter.

Parameters
string$typeConverterclass name of type converter
array$options
Returns
this

Definition at line 303 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\$typeConverter, ClassLoadingInformation\getClassNameForAlias(), and PropertyMappingConfiguration\getTypeConvertersWithParentClasses().

shouldMap (   $propertyName)

The behavior is as follows:

  • 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
string$propertyName
Returns
bool TRUE if the given propertyName should be mapped, FALSE otherwise.

Definition at line 114 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\$mapUnknownProperties.

shouldSkip (   $propertyName)

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

Parameters
string$propertyName
Returns
bool

Implements PropertyMappingConfigurationInterface.

Definition at line 138 of file PropertyMappingConfiguration.php.

shouldSkipUnknownProperties ( )

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

Returns
bool

Implements PropertyMappingConfigurationInterface.

Definition at line 228 of file PropertyMappingConfiguration.php.

References PropertyMappingConfiguration\$skipUnknownProperties.

skipProperties ( )

Skip a list of specific properties. All arguments of skipProperties are used here (varargs).

Example: skipProperties('unused', 'dummy')

Returns
this

Definition at line 181 of file PropertyMappingConfiguration.php.

skipUnknownProperties ( )

When this is enabled, properties that are disallowed will be skipped instead of triggering an error during mapping.

Returns
this

Definition at line 215 of file PropertyMappingConfiguration.php.

traverseProperties ( array  $splittedPropertyPath)

Traverse the property configuration. Only used by forProperty().

Parameters
array$splittedPropertyPath
Returns
(or a subclass thereof)

Definition at line 372 of file PropertyMappingConfiguration.php.

Referenced by PropertyMappingConfiguration\forProperty().

Member Data Documentation

$configuration
protected

Definition at line 46 of file PropertyMappingConfiguration.php.

$mapping = []
protected

Definition at line 60 of file PropertyMappingConfiguration.php.

$mapUnknownProperties = false
protected
$propertiesNotToBeMapped = []
protected

Definition at line 86 of file PropertyMappingConfiguration.php.

$propertiesToBeMapped = []
protected

Definition at line 72 of file PropertyMappingConfiguration.php.

$propertiesToSkip = []
protected

Definition at line 79 of file PropertyMappingConfiguration.php.

$subConfigurationForProperty = []
protected

Definition at line 53 of file PropertyMappingConfiguration.php.

const PROPERTY_PATH_PLACEHOLDER = '*'

Placeholder in property paths for multi-valued types

Definition at line 36 of file PropertyMappingConfiguration.php.