Skip to content

bugfix_clear-entity-manager-after-each-event-20161024152341Z-88025de63d7be8a8d637aac2cddc76a7a53a3b2c

Pre-release
Pre-release
Compare
Choose a tag to compare
Clear entity managers references after each event

Doctrine uses PHP's spl_object_hash. Hashes can be re-assigned after a certain object has been destroyed / garbage collected.

It seems that we have reached an edge case wherein hash collisions occur during event replays.

Clearing the entity manager after each event ensures the entity manager correctly inserts entities that have not been seen before.

This does come with the caveat that event listeners cannot hold references to entities crossing events.