‪TYPO3CMS  9.5
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

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

Public Attributes

const PROPERTY_PATH_PLACEHOLDER = '*'
 

Protected Member Functions

array getTypeConvertersWithParentClasses ($typeConverter)
 

Protected Attributes

array $configuration
 
TYPO3 CMS Extbase Property PropertyMappingConfigurationInterface[] $subConfigurationForProperty = array( )
 
array $mapping = array( )
 
TYPO3 CMS Extbase Property TypeConverterInterface $typeConverter
 
array $propertiesToBeMapped = array( )
 
array $propertiesToSkip = array( )
 
array $propertiesNotToBeMapped = array( )
 
bool $skipUnknownProperties = false
 
bool $mapUnknownProperties = false
 

Detailed Description

Concrete configuration object for the PropertyMapper.

Definition at line 20 of file PropertyMappingConfiguration.php.

Member Function Documentation

◆ allowAllProperties()

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

Allow all properties in property mapping, even unknown ones.

Returns
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration this

Definition at line 126 of file PropertyMappingConfiguration.php.

◆ allowAllPropertiesExcept()

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

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

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

Returns
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration this

Definition at line 172 of file PropertyMappingConfiguration.php.

◆ allowProperties()

TYPO3 CMS Extbase Property PropertyMappingConfiguration 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
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration

Definition at line 140 of file PropertyMappingConfiguration.php.

◆ forProperty()

TYPO3 CMS Extbase Property PropertyMappingConfiguration 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
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration (or a subclass thereof)

Definition at line 320 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 PropertyMappingConfigurationInterface 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
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface the property mapping configuration for the given $propertyName.

Implements TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 211 of file PropertyMappingConfiguration.php.

References TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\PROPERTY_PATH_PLACEHOLDER.

◆ getConfigurationValue()

mixed 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 242 of file PropertyMappingConfiguration.php.

◆ getTargetPropertyName()

string 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 229 of file PropertyMappingConfiguration.php.

◆ getTypeConverter()

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

Return the type converter set for this configuration.

Returns
‪\TYPO3\CMS\Extbase\Property\TypeConverterInterface

Implements TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface.

Definition at line 355 of file PropertyMappingConfiguration.php.

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

◆ getTypeConvertersWithParentClasses()

array 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$typeConverter‪The type converter class
Returns
‪array Class names of type converters

Definition at line 304 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 TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::setMapping (   $sourcePropertyName,
  $targetPropertyName 
)

Define renaming from Source to Target property.

Parameters
string$sourcePropertyName
string$targetPropertyName
Returns
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration this

Definition at line 258 of file PropertyMappingConfiguration.php.

◆ setTypeConverter()

TYPO3 CMS Extbase Property PropertyMappingConfiguration 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
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration this

Definition at line 366 of file PropertyMappingConfiguration.php.

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

◆ setTypeConverterOption()

TYPO3 CMS Extbase Property PropertyMappingConfiguration TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::setTypeConverterOption (   $typeConverter,
  $optionKey,
  $optionValue 
)

◆ setTypeConverterOptions()

TYPO3 CMS Extbase Property PropertyMappingConfiguration TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::setTypeConverterOptions (   $typeConverter,
array  $options 
)

Set all options for the given $typeConverter.

Parameters
string$typeConverter‪class name of type converter
array$options
Returns
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration this

Definition at line 271 of file PropertyMappingConfiguration.php.

References TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\$typeConverter, and TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\getTypeConvertersWithParentClasses().

◆ shouldMap()

bool 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 93 of file PropertyMappingConfiguration.php.

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

◆ shouldSkip()

bool 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 116 of file PropertyMappingConfiguration.php.

◆ shouldSkipUnknownProperties()

bool 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 200 of file PropertyMappingConfiguration.php.

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

◆ skipProperties()

TYPO3 CMS Extbase Property PropertyMappingConfiguration 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
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration this

Definition at line 156 of file PropertyMappingConfiguration.php.

◆ skipUnknownProperties()

TYPO3 CMS Extbase Property PropertyMappingConfiguration 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
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration this

Definition at line 188 of file PropertyMappingConfiguration.php.

◆ traverseProperties()

TYPO3 CMS Extbase Property PropertyMappingConfiguration TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::traverseProperties ( array  $splittedPropertyPath)

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

Parameters
array$splittedPropertyPath
Returns
‪\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration (or a subclass thereof)

Definition at line 332 of file PropertyMappingConfiguration.php.

References TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\PROPERTY_PATH_PLACEHOLDER.

Referenced by TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\forProperty().

Member Data Documentation

◆ $configuration

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

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

Definition at line 34 of file PropertyMappingConfiguration.php.

◆ $mapping

array TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$mapping = array( )
protected

Keys which should be renamed

Definition at line 46 of file PropertyMappingConfiguration.php.

◆ $mapUnknownProperties

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

If TRUE, unknown properties will be mapped.

Definition at line 80 of file PropertyMappingConfiguration.php.

Referenced by TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\shouldMap().

◆ $propertiesNotToBeMapped

array TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$propertiesNotToBeMapped = array( )
protected

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

Definition at line 68 of file PropertyMappingConfiguration.php.

◆ $propertiesToBeMapped

array TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$propertiesToBeMapped = array( )
protected

List of allowed property names to be converted

Definition at line 56 of file PropertyMappingConfiguration.php.

◆ $propertiesToSkip

array TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$propertiesToSkip = array( )
protected

List of property names to be skipped during property mapping

Definition at line 62 of file PropertyMappingConfiguration.php.

◆ $skipUnknownProperties

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

If TRUE, unknown properties will be skipped during property mapping

Definition at line 74 of file PropertyMappingConfiguration.php.

Referenced by TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration\shouldSkipUnknownProperties().

◆ $subConfigurationForProperty

TYPO3 CMS Extbase Property PropertyMappingConfigurationInterface [] TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration::$subConfigurationForProperty = array( )
protected

Stores the configuration for specific child properties.

Definition at line 40 of file PropertyMappingConfiguration.php.

◆ $typeConverter

◆ PROPERTY_PATH_PLACEHOLDER

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