ddeboer/data-import — pull request #108 by guillaume-petit (2014-08-12 12:20:35+00:00)
Title: Adding some functionalities in DoctrineReader/Writer and CsvWriter

-- Copied from #97 --

Hello,

For the need of our project, I added some functionalities to your lib that might be useful for others.

- WorkflowException
During the workflow process, instead of throwing an exception, I wrapped it in a WorkflowException with the current item number that failed.

- DoctrineReader
I added the possibility to provide your own QueryBuilder when reading doctrine datasource. This allows you to export customized queries from the doctrine model.

- CsvWriter
Add headers at the top of the CSV file. (But of course, the consistency between the header and the data rows is not guaranteed...)

- DoctrineWriter
Add a default value when writing in doctrine entity (for a mandatory field not provided by the reader). I implemented it only for the DoctrineWriter but it may make sense for other writers as well, didn't check it...
I also encoutered an issue when batch writing large quantity of data. It was related to clearing the entity manager after writing object in the database. The process couldn't continue because some information were lost (I don't remember exactly what was the issue but I can reproduce it if needed). Clearing the Entity Manager only at the end of the process solved the problem and seems quite acceptable.

Anyway, thanks for your lib. It was really useful to me to implement CSV <=> Doctrine import/export !

Best regards
Guillaume