Bug Report
scheduledForSynchronization not erases when no changes on the flush.
| Q |
A |
| BC Break |
yes/no |
| Version |
2.6.3 |
Summary
I use DEFERRED_EXPLICIT policy for entities in my app. And app crashes with out of memory error during batch processing. Because scheduledForSynchronization keeps references to entities when no changes for commit:
|
return; // Nothing to do. |
In this case UnitOfWork::postCommitCleanup() not called.
How to reproduce
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
*/
class Entity
{
}
$entity = $em->find(Entity::class, 123);
$em->persist($entity);
$em->flush();
$em->detach($entity);
var_dump($em->getUnitOfWork()->size()); // int(0)
var_dump($em->getUnitOfWork()->isScheduledForDirtyCheck($entity)); // bool(true)
Was expected that isScheduledForDirtyCheck() return false after commit (flush) in any case.