Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Ready for review Stale

90690[FEATURE] Allow converting objects to other objects

Simon Schaufelberger CR 0 V 0 Hard +289 −21 updated 09/04/26, 22:18

Commit message

Instead of using own factories or other classes to transform one object
into another, an officially supported type converter is now provided
that also checks the input and output type with priority.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 6
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/90/90690/6 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/90/90690/6 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Issues 1

Files 8

Review log 1318

  1. Simon Schaufelberger uploaded patch set 1 09/15/25, 23:26

  2. core-ci voted on patch set 1 V -1 09/15/25, 23:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84998

  3. Simon Schaufelberger uploaded patch set 2 V -1 09/16/25, 10:01

  4. core-ci voted on patch set 2 V +1 09/16/25, 10:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85020

  5. Garvin Hicking commented on patch set 2 09/16/25, 10:20

    Please add a commit message body shortly explaining the commit

    Feature-107462-TypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:6

    Mention "Extbase" in the title

    Feature-107462-TypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:14

    Also mention "Extbase" here. Also, the later code uses the "PropertyMapper" and not specifically a "TypeConverter" so maybe both terms could briefly be explained here? As a ready I wonder what the specific TypeConverter would be - is it an own one? A core one? Which one from the Core? Adding the code example of the actual typeconverter and/or service YAML config would make this more complete I think
  6. Simon Schaufelberger uploaded patch set 3 V +1 09/18/25, 14:57

  7. Simon Schaufelberger commented on patch set 2 09/18/25, 14:57

    Feature-107462-TypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:6 Reply

    Done

    Feature-107462-TypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:14 Reply

    I hope it is better now.
  8. Simon Schaufelberger commented on patch set 3 09/18/25, 14:58

    Reply

    Done
  9. Stefan Froemken commented on patch set 3 CR -1 09/18/25, 15:46

    Feature-107462-ExtbaseTypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:63

    Wrong namespace

    Feature-107462-ExtbaseTypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:69

    Wrong classname

    Feature-107462-ExtbaseTypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:77

    PropertyMapper mapps data from Request (original is STRING or ARRAY) into a specific data type. The origin can never be an object. And PropertyMapping should be handled before the action call and not from within. Looks like using tools for the wrong context.
  10. Garvin Hicking commented on patch set 3 09/18/25, 15:53

    Feature-107462-TypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:14 Reply Unresolved

    Honestly I'm still trying to grasp the concept for this. The way I use typeConverters is on request-level, which mainly knows int/string/null/array basic types and can convert those (like time integers to a date object) When I deal with DTOs I usually use the datamapper in my own service classes, or even in a repository or the action. Also, usually I have a model's "createFromDto()" method that returns a self instance accessing the getters of the DTO and the setters of the target object. That leaves more freedom to do calucations and transformations, because usually a DTO is not really 1:1 mappable to my final objects. I see the "straight" ability here to use a typeconverter like you do, but it somehow feels like breaking a "blood/brain" barrier when dealing with request input. I wonder if we should keep that intact and recommend other patterns to deal with object transformation. I don't feel authoritative enough to decide if this still can be beneficial / is valid, so I'd love to hear some more thoughts.
  11. Simon Schaufelberger commented on patch set 3 09/18/25, 22:18

    Feature-107462-ExtbaseTypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:63 Reply

    Done

    Feature-107462-ExtbaseTypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:69 Reply

    Done

    Feature-107462-ExtbaseTypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:77 Reply

    PropertyMapper CAN map data from a request but is not limited to it. It has no requirement that the data is coming from a request. It can also be used manually to map any input source into another. I'm using the PropertyMapper intensively in my own projects to also map raw database data into a model for example data from the Doctrine QueryBuilder without all the extbase stuff involved. Maybe that is not the best approach for you but for me it is.
  12. Simon Schaufelberger uploaded patch set 4 CR -1 09/18/25, 22:19

  13. core-ci voted on patch set 4 V +1 09/18/25, 22:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85136

  14. Stefan Bürk commented on patch set 4 09/19/25, 13:15

    Feature-107462-ExtbaseTypeConvertersShouldSupportConvertingOneObjectIntoAnother.rst:77 Reply Unresolved

    Not checked this out deeper, but already had this on a todo for extension to look into things like that and implementend something. However, just asking, instead doing that on that low level .. would it not more reasonable to have a look into symfonys 7.3 ObjectMapper feature (albeit beeing marked as experiemental) and having a "type converter" dispatching to object manager stuff ... https://symfony.com/doc/current/object_mapper.html At least I had that in the look, but not suitable for the extension to do older TYPO3 version support reauired not having that symfony version on board. On the other hand .. must this really be part / a type converter or would not just the object mapper a better abroach to be used within a action to transform/map the data from the passed DTO to the persisting Domain Model object ? oO Don't get me wrong .. just looked 5 seks into this change and only wanted to share question and pointing out to ObjectMapper if that would make (more) sense. Maybe that would help to have only a generic tpeconverter and having the "configuration" on the object level with the map attributes from ObjectMapper or something like that. Not sure if you had/have the new ObjectMapper on the table or if that is coming for a long time usage in extensions. Maybe worth to (re)think about it ? Not sure ...
  15. Simon Schaufelberger uploaded patch set 5 V +1 05/09/26, 18:06

  16. core-ci voted on patch set 5 V +1 05/09/26, 18:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101755

  17. Simon Schaufelberger uploaded patch set 6 V +1 09/04/26, 22:04

  18. core-ci voted on patch set 6 V +1 09/04/26, 22:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107908