‪TYPO3CMS  10.4
TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter:
TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter TYPO3\CMS\Extbase\Property\TypeConverterInterface TYPO3\CMS\Core\SingletonInterface

Public Member Functions

bool canConvertFrom ($source, string $targetType)
 
array string convertFrom ($source, string $targetType, array $convertedChildProperties=[], PropertyMappingConfigurationInterface $configuration=null)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter
 injectObjectManager (ObjectManagerInterface $objectManager)
 
string[] getSupportedSourceTypes ()
 
string getSupportedTargetType ()
 
string getTargetTypeForSource ($source, string $originalTargetType, PropertyMappingConfigurationInterface $configuration=null)
 
int getPriority ()
 
array getSourceChildPropertiesToBeConverted ($source)
 
string getTypeOfChildProperty (string $targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration)
 

Public Attributes

const CONFIGURATION_DELIMITER = 'delimiter'
 
const CONFIGURATION_REMOVE_EMPTY_VALUES = 'removeEmptyValues'
 
const CONFIGURATION_LIMIT = 'limit'
 

Protected Attributes

string[] $sourceTypes = array( 'array', 'string' )
 
string $targetType = 'array'
 
int $priority = 10
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter
string[] $sourceTypes = array( )
 
string $targetType = ''
 
int $priority
 
TYPO3 CMS Extbase Object ObjectManagerInterface $objectManager
 

Detailed Description

Converter which transforms strings/arrays to arrays.

Definition at line 27 of file ArrayConverter.php.

Member Function Documentation

◆ canConvertFrom()

bool TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::canConvertFrom (   $source,
string  $targetType 
)

We can only convert empty strings to array or array to array.

Parameters
mixed$source
string$targetType
Returns
‪bool

only to be used within Extbase, not part of TYPO3 Core API.

Reimplemented from TYPO3\CMS\Extbase\Property\TypeConverter\AbstractTypeConverter.

Definition at line 53 of file ArrayConverter.php.

◆ convertFrom()

array string TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::convertFrom (   $source,
string  $targetType,
array  $convertedChildProperties = [],
PropertyMappingConfigurationInterface  $configuration = null 
)

Convert from $source to $targetType, a noop if the source is an array. If it is an empty string it will be converted to an empty array. If the type converter has a configuration, it can convert non-empty strings, too

Parameters
string | array$source
string$targetType
array$convertedChildProperties
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface$configuration
Returns
‪array|string

Implements TYPO3\CMS\Extbase\Property\TypeConverterInterface.

Definition at line 69 of file ArrayConverter.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Member Data Documentation

◆ $priority

int TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::$priority = 10
protected

Definition at line 43 of file ArrayConverter.php.

◆ $sourceTypes

string [] TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::$sourceTypes = array( 'array', 'string' )
protected

Definition at line 35 of file ArrayConverter.php.

◆ $targetType

string TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::$targetType = 'array'
protected

Definition at line 39 of file ArrayConverter.php.

◆ CONFIGURATION_DELIMITER

const TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::CONFIGURATION_DELIMITER = 'delimiter'

Definition at line 29 of file ArrayConverter.php.

◆ CONFIGURATION_LIMIT

const TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::CONFIGURATION_LIMIT = 'limit'

Definition at line 31 of file ArrayConverter.php.

◆ CONFIGURATION_REMOVE_EMPTY_VALUES

const TYPO3\CMS\Extbase\Property\TypeConverter\ArrayConverter::CONFIGURATION_REMOVE_EMPTY_VALUES = 'removeEmptyValues'

Definition at line 30 of file ArrayConverter.php.