Feature #27499

Refactor TypeConverter API

Added by Bastian Waidelich over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Should have
Category:
Property
Start date:
2011-06-16
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Currently TypeConverters support multiple source but only one target type.
As discussed with Robert, this should be changed so that you can specify an array of supported TargetTypes.
This makes especially sense when using TypeConverters independently from the PropertyMapper.

The TypeConverterInterface should be adjusted like:

-getSupportedTargetType()
+getSupportedTargetTypes()

Sebastian Kurfuerst I'm assigning this to you, because that should be changed before the backport of the PropertyMapper. Feel free to unasign yourself if you can't to it atm ;)


Related issues

Related to TYPO3.Flow - Bug #27611: Rename and combine TypeConvertersResolvedBastian Waidelich2011-06-21

Actions
#1

Updated by Bastian Waidelich over 10 years ago

  • Subject changed from TypeConverters should support multiple target types to Support multiple target types in TypeConverters
#2

Updated by Robert Lemke over 10 years ago

  • Target version set to 1.0 beta 1
#3

Updated by Bastian Waidelich over 10 years ago

Bastian Waidelich wrote:

-getSupportedTargetType()
+getSupportedTargetTypes()

As mentioned in the scrum meeting, I'm not sure anymore whether that makes sense..
Instead we should strive for a one-converter-per-type approach IMO.

That way we could get rid of three of the existing converters:

ArrayCollectionConverter -> ArrayCollectionConverter
ArrayToArrayConverter -> ArrayConverter
ArrayToObjectConverter -> ObjectConverter
ArrayToSplObjectStorageConverter -> SplObjectStorageConverter
BooleanToBooleanConverter -> BooleanConverter
IntegerToIntegerConverter -> IntegerConverter
PersistentObjectConverter -> PersistentObjectConverter
StringToBooleanConverter -> (not needed anymore)
StringToFloatConverter -> FloatConverter
StringToIntegerConverter -> (not needed anymore)
StringToSplObjectStorageConverter -> (not needed anymore)
StringToStringConverter -> StringConverter

In the long run, we should add a convertTo() method for "reversed conversions"

#4

Updated by Sebastian Kurfuerst over 10 years ago

change API: rename 'canConvert' to 'canConvertFrom' in TypeConverterInterface

#5

Updated by Mr. Hudson over 10 years ago

Patch set 1 of change I9128ab6edc4ee103f8c39bf25f35da296e0506f1 has been pushed to the review server.
It is available at http://review.typo3.org/2895

#6

Updated by Sebastian Kurfuerst over 10 years ago

  • Status changed from New to Under Review
  • % Done changed from 0 to 90
#7

Updated by Mr. Hudson over 10 years ago

Patch set 2 of change I9128ab6edc4ee103f8c39bf25f35da296e0506f1 has been pushed to the review server.
It is available at http://review.typo3.org/2895

#8

Updated by Bastian Waidelich over 10 years ago

  • Subject changed from Support multiple target types in TypeConverters to Refactor TypeConverter API
  • canConvert -> canConvertFrom
  • getProperties -> getSourceChildPropertiesToBeConverted
  • getTypeOfProperty -> getTypeOfChildProperty
  • $subProperties -> $convertedChildProperties
#9

Updated by Sebastian Kurfuerst over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 90 to 100

Also available in: Atom PDF