heimrichhannot/contao-entity-import-bundle

Modify data while import

Opened this issue · 2 comments

In the JSON file I want to import dates are formatted as strings (e.g. 2023-12-31T00:00:00+00:00), but in the tl-table the date has to get saved as integer.

Is there a possibility to modify data threw import process?

If there is no option in the backend (sorry, I'm not very familar with this bundle), then there are plenty php events, I think this should not be a problem: https://github.com/heimrichhannot/contao-entity-import-bundle#events

vvohh commented

Exactly, the 'BeforeItemImportEvent' will be a good fit for your purpose, you can then use the methods 'getItem()' or 'getMappedItem()' from the event to get to the values from your source, process it as you would prefer then ultimately 'setMappedItem($array)' to continue the process.