ORM EntityManager
Permalink
Hi,
I have a package that uses some entities. In a job do several changes to an entity and at the end of the job I want to save (=flush) the actual changes. That what the entity manager is good at ;-)
Some where in the proces I import a file and that where things go "wrong". In the import proces the flush is called, so all my changes to my entity are flushed also. :(
In the C5 code there a lot of flushes (like the old "save" on a object). Shouldn't those flushes be on the entity itself ($em->flush($entity)) instead of a full flush ($em->flush())?
Or.... is it possible to get another entity manager for the package?
I know that I can create another db connection and get that entity manager, but is it doable to copy the default connection for a package? (not very handy when changing database credentials...).
Any idea?
(I want to prevent to do a flush after each change).
I have a package that uses some entities. In a job do several changes to an entity and at the end of the job I want to save (=flush) the actual changes. That what the entity manager is good at ;-)
Some where in the proces I import a file and that where things go "wrong". In the import proces the flush is called, so all my changes to my entity are flushed also. :(
In the C5 code there a lot of flushes (like the old "save" on a object). Shouldn't those flushes be on the entity itself ($em->flush($entity)) instead of a full flush ($em->flush())?
Or.... is it possible to get another entity manager for the package?
I know that I can create another db connection and get that entity manager, but is it doable to copy the default connection for a package? (not very handy when changing database credentials...).
Any idea?
(I want to prevent to do a flush after each change).