Feature #58696

TypedArrayConverter

Added by Bastian Waidelich about 1 year ago. Updated about 1 year ago.

Status:Resolved Start date:2014-05-11
Priority:Should have Due date:
Assigned To:Bastian Waidelich % Done:

100%

Category:Property
Target version:-
PHP Version: Complexity:
Has patch:No

Description

Flow is missing a TypeConverter that can turn simple arrays into an "object array" (aka generics).
For this to work the PropertyMapper needs to be adjusted because currently it cuts off possible element type notations ("<Some\Element\Type>") from the targetType before calling canConvertFrom().

Associated revisions

Revision a7520579
Added by Bastian Waidelich about 1 year ago

[!!!][TASK] Don't cut off element type in PropertyMapper

Before a TypeConverter is used, the PropertyMapper calls a method
``canConvertFrom()`` on it with the current source and the expected
target type.

Previously a possible element type was cut off from the target type
before, so for a target type of "SomeType<SomeElementType>" only the
string "SomeType" was passed to ``canConvertFrom()``.
This makes it impossible to create a TypeConverter for a collection
type of a specific element type.

This is a breaking change if you created a custom TypeConverter for
a collection type (such as ``array``, ``SplObjectStorage``,
``ArrayObject`` or one of its subtypes), implemented the
``canConvertFrom()`` method and expected the second parameter to be
the truncated target type.
In this case simply add a line::

$targetType = TypeHandling::truncateElementType($targetType);

to the beginning of the method body.

Change-Id: I5859f4494beeb7fb86dd82a47b15172d849e252e
Related: #58696
Releases: master

Revision d068f42d
Added by Bastian Waidelich about 1 year ago

[FEATURE] Typed array TypeConverter

Implements a TypeConverter for object arrays (aka generics).
This allows for converting simple arrays to arrays of entites
for example, executing type conversion for the element type
recursively.

Change-Id: I304e0b76164f83a85c3ca3f4d0ed630b04319426
Resolves: #58696
Releases: master

History

#1 Updated by Gerrit Code Review about 1 year ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/30010

#2 Updated by Gerrit Code Review about 1 year ago

Patch set 2 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/30010

#3 Updated by Gerrit Code Review about 1 year ago

Patch set 3 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/30010

#4 Updated by Bastian Waidelich about 1 year ago

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

Also available in: Atom PDF