Loenix
Loenix

Reputation: 1089

How to bulk import entities with Doctrine?

How to bulk import entities with Doctrine ?

Business requirements

I am using Doctrine 3 to bulk import a list of entities from a CSV.
Each row creates 100 entities~ and I flush it each 10 rows.
All entities are having a relationship with User (createUser)

But this is not this easy with the entity manager of Doctrine... For each solution I tried, I got an issue, so I ran out of solution and went here.

What I have tried ?

  [Doctrine\ORM\ORMInvalidArgumentException]                                                                                                                                                                                                                                                                        
  Multiple non-persisted new entities were found through the given association graph

I could have more functional solutions but this harms the maintainability of the project.

Upvotes: 0

Views: 23

Answers (0)

Related Questions