wizacode/php-etl

Create a component factory

ecourtial opened this issue · 1 comments

In some use case, we might need many instance of the same component (ETL, CSV Extractor...).

So far there is two way to proceed:

  • Use DI. But your constructor could become huge.
  • Use DI + clone. But become difficult to test.

We might consider to create a factory. It would be a class with one public method get(), with two parameters:

  • The classname of the request component
  • The optionnal array of the options

This might be a good way to create an optional logger interface as a standard interface of a Step and inject a single logger for an overall pipeline.