Programming Rambling

mrzard's ramblings in the wild

Fluhsing Only Desired Entities With Doctrine

| Comments

Sometimes, you may be working with several entities at the same time. If this entities are managed by Doctrine, you may find yourself in the situation where you want to flush only some of them. If you want to do so, you can pass an array of entities to the flush(), so it only affects the entities you explicitly pass to the function.

This is very useful to avoid side-effects in some instances.