Feature #27499

Refactor TypeConverter API

Added by Bastian Waidelich about 4 years ago. Updated about 4 years ago.

Status:Resolved Start date:2011-06-16
Priority:Should have Due date:
Assigned To:Sebastian Kurfuerst % Done:

100%

Category:Property
Target version:TYPO3 Flow Base Distribution - 1.0 beta 1
PHP Version: Complexity:
Has patch:

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 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 TypeConverters Resolved 2011-06-21

Associated revisions

Revision 95dc5123
Added by Sebastian Kurfuerst about 4 years ago

[+BUGFIX] (Property): Refactor TypeConverter API

  • canConvert -> canConvertFrom
  • getProperties -> getSourceChildPropertiesToBeConverted
  • getTypeOfProperty -> getTypeOfChildProperty
  • $subProperties -> $convertedChildProperties

Resolves: #27499
Change-Id: I9128ab6edc4ee103f8c39bf25f35da296e0506f1

History

#1 Updated by Bastian Waidelich about 4 years ago

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

#2 Updated by Robert Lemke about 4 years ago

  • Target version set to 1.0 beta 1

#3 Updated by Bastian Waidelich about 4 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 about 4 years ago

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

#5 Updated by Mr. Hudson about 4 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 about 4 years ago

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

#7 Updated by Mr. Hudson about 4 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 about 4 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 about 4 years ago

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

Also available in: Atom PDF