Project

General

Profile

Actions

Feature #66623

closed

Make mapSingleRow public to avoid unnessesary database access

Added by Jan Kiesewetter over 9 years ago. Updated 11 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-04-28
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Needs Decision

Description

In case of content elements build with Extbase and Fluid or other datasources the DataMapper can be used to transfer an array to an object.

I use the following to transfer the already available data array of a content element to my content element object:
https://bitbucket.org/t3easy_de/basecontent/src/b3f3f8b2faeaf00bef75c35a99c063342b0b592b/Classes/Controller/ContentObjectController.php?at=develop#cl-47

This avoids the injection and call to the repository and use the findByUid(data['uid']) and at the end do the same and call the DataMapper.

Could we make the mapSingleRow public and define "map" and "mapSingleRow" as api?

Actions #1

Updated by Susanne Moog over 5 years ago

  • Status changed from New to Needs Feedback

The whole DataMapper is internal and will likely stay that way. Can you maybe rephrase the ticket to articulate what you want to achieve and why?

Actions #2

Updated by Jan Kiesewetter over 5 years ago

I used the DataMapper to build an object of the data array already available by an extbase content element.
In the meantime DataProcessors are available and are perfect for simple content elements with not that complex content elements.
But for more complex content elements build with Extbase it's helpfull to get the content element as an object.
Using `\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper->map` prevents an additional sql query as the data of the CE is already fetched and you don't need a repository class for the CE.

The DataMapper was marked internal on 1 Oct 2018, long after the issue was created:
https://github.com/TYPO3/TYPO3.CMS/commit/65a5511149dbabeb58fc86d9c4f66188ea040d90#diff-a8aa95385a4a9a2e39c52f857dbc0e28R21

Actions #3

Updated by Susanne Moog over 5 years ago

  • Tracker changed from Task to Feature
  • Status changed from Needs Feedback to New

Ok, got the case.

Not sure if the DataMapper of Extbase would be the way to go or some more generic array-to-object mapper which could be integrated in the core but one way or the other, the use case is valid.

(Yes, I know that the whole class was marked internal by annotation last year, but extbase was one part which used @api to annotate public api instead of the other way around before that IIRC)

Actions #4

Updated by Georg Ringer over 4 years ago

  • Sprint Focus set to Needs Decision
Actions #5

Updated by Stefan Froemken over 1 year ago

  • Status changed from New to Needs Feedback

Hello,

is this feature still needed?
I mean: It's easy to wrap your data into an array and use map() method without any problems.
The map() method in DataMapper has not changed since over 8 years.
Further you can implement your own simple DataMapper like that: https://github.com/jweiland-net/maps2/blob/TYPO3_6-2/Classes/Utility/DataMapper.php without all these language and TCA checks.

Stefan

Actions #6

Updated by Christian Kuhn 11 months ago

  • Status changed from Needs Feedback to Closed

Hey.

I hope we don't disturb anyone by closing the issue for now: It seems unlikely the DM in extbase is reworked for now and there haven't been many changes for years as Stefan said. As far as I can see, map() does not fire DB calls / anymore? If this is a pressing issue, we could still make the method public. Let's do that in a fresh issue in case this is still an issue.

Actions

Also available in: Atom PDF