TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration:
TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface TYPO3\CMS\Extbase\Mvc\Controller\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()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::allowAllProperties ( )

Allow all properties in property mapping, even unknown ones.

Returns
this

Definition at line 149 of file PropertyMappingConfiguration.php.

◆ allowAllPropertiesExcept()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\traverseProperties().

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfiguration\allowCreationForSubProperty(), TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfiguration\allowModificationForSubProperty(), and TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfiguration\setTargetTypeForSubProperty().

◆ getConfigurationFor()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 240 of file PropertyMappingConfiguration.php.

◆ getConfigurationValue()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 272 of file PropertyMappingConfiguration.php.

◆ getTargetPropertyName()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::getTargetPropertyName (   $sourcePropertyName)

Maps the given $sourcePropertyName to a target property name.

Parameters
string$sourcePropertyName
Returns
string property name of target

Implements TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 258 of file PropertyMappingConfiguration.php.

◆ getTypeConverter()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::getTypeConverter ( )

Return the type converter set for this configuration.

Returns

Implements TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 396 of file PropertyMappingConfiguration.php.

References TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$typeConverter.

◆ getTypeConvertersWithParentClasses()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$typeConverter.

Referenced by TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\setTypeConverterOption(), and TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\setTypeConverterOptions().

◆ setMapping()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$typeConverter.

◆ setTypeConverterOption()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$typeConverter, TYPO3\CMS\Core\Core\ClassLoadingInformation\getClassNameForAlias(), and TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\getTypeConvertersWithParentClasses().

◆ setTypeConverterOptions()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$typeConverter, TYPO3\CMS\Core\Core\ClassLoadingInformation\getClassNameForAlias(), and TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\getTypeConvertersWithParentClasses().

◆ shouldMap()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$mapUnknownProperties.

◆ shouldSkip()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::shouldSkip (   $propertyName)

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

Parameters
string$propertyName
Returns
bool

Implements TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 138 of file PropertyMappingConfiguration.php.

◆ shouldSkipUnknownProperties()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::shouldSkipUnknownProperties ( )

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

Returns
bool

Implements TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 228 of file PropertyMappingConfiguration.php.

References TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$skipUnknownProperties.

◆ skipProperties()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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()

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\forProperty().

Member Data Documentation

◆ $configuration

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$configuration
protected

Definition at line 46 of file PropertyMappingConfiguration.php.

◆ $mapping

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$mapping = []
protected

Definition at line 60 of file PropertyMappingConfiguration.php.

◆ $mapUnknownProperties

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$mapUnknownProperties = false
protected

◆ $propertiesNotToBeMapped

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$propertiesNotToBeMapped = []
protected

Definition at line 86 of file PropertyMappingConfiguration.php.

◆ $propertiesToBeMapped

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$propertiesToBeMapped = []
protected

Definition at line 72 of file PropertyMappingConfiguration.php.

◆ $propertiesToSkip

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$propertiesToSkip = []
protected

Definition at line 79 of file PropertyMappingConfiguration.php.

◆ $skipUnknownProperties

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$skipUnknownProperties = false
protected

◆ $subConfigurationForProperty

TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$subConfigurationForProperty = []
protected

Definition at line 53 of file PropertyMappingConfiguration.php.

◆ $typeConverter

◆ PROPERTY_PATH_PLACEHOLDER

const TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::PROPERTY_PATH_PLACEHOLDER = '*'

Placeholder in property paths for multi-valued types

Definition at line 36 of file PropertyMappingConfiguration.php.