Skip to content
Kai Möller edited this page Jan 13, 2020 · 3 revisions

Thoughts

  • do not set DataProvider and ImportResult within constructor of importer
  • An importer instance gets its DataProvider via parameter of import method
  • When import method is called the first thing do do is creating ImportResult.
  • Implement ImporterInterface
interface ImporterInterface
{
    public function import(DataProviderInterface $dataProvider);
}
  • Implement a DataProviderFactory wich creates and configures the DataProvider. The validation of parameters for the DataProvider i.e. file encoding for csv files could be done here.
  • To run an import the steps would be
    1. create an instance of the DataProviderFactory
    2. create an instance of the Importer
    3. use the DataProviderFactory for creating the DataProvider
    4. run the import method of the Importer with the created DataProvider as parameter
  • When using EntityImport start a transaction before doing anything such as deleting rows in beforeProcessRows()

Clone this wiki locally