Skip to main content


Import Data within TYPO3


TYPO3 developers are often faced with the same requirement: Import data into TYPO3. TYPO3 itself offers many ways to import data into the system. The DataHandler (TCE) or Extbase might come to your mind, as well as plain Doctrine DBAL queries. This post will explain my views on each of the options and their pros and cons. I don't consider any of them the general solution, but the pros and cons might help you find the one suiting your current use case best.

DataHandler


I always would suggest DataHandler first for the following reasons:

  • API is pretty simple, build a single array and submit.
  • It handles everything you can think of, and everything you don't remember:
  • History
  • Logging
  • Relations
  • Permissions
  • Hooks (indexing in solr, or whatever your system uses hooks for)
  • Cache flushing
  • … (things I forgot)

But there are some downsides:

  • It is slow (You can tweak the DataHandler instance to skip some things and be more performant)
  • It might do more than you want, e.g. history, logging, relations, permissions, hooks, cache flushing, ….


Doctrine DBAL


I than would recommend Doctrine DBAL for the following reasons:

  • You are in full control. You can do exactly what you want the way you want, and can optimize for memory and performance.

But it also has downsides:

  • You need to remember all necessary steps and rebuild integrations, e.g. indexing into solr, triggering cache flushes, etc.


Extbase


And then there is Extbase for the following reasons:

  • You stay in OOP
  • Most developers are probably more familiar with Extbase than the other APIs

With downsides:

  • It was not build for that task.
  • You need to add workarounds to keep performance okay.
  • You still need to do extra work like triggering indexing, cache flushing, etc.


It depends


I would say it depends on:

  • What do you need from the system, do you need hooks, logging (history) and cache flushing?
  • Do you know what you do and want to have full control over every aspect?
  • How much data do you have, how much memory and time do you have?
  • Do you want to keep OOP?

This is a recurring topic, but Eric Harrer finally made me write this blog post by bringing up the topic once more at the Fediverse: https://phpc.social/@ErHaWeb/111096230843826340.

Read more about:


https://daniel-siepmann.de/import-data-within-typo3.html


Survey for #TYPO3 #Developers: Data from an external source should be written into #Database tables with #relations via #Symfony #Command. Which method would you choose? Feel free to justify your answer in the comments.