Skip to content


DDC-1173: Fatal error when a listener resets an object in onFlush and recompute the changeset #1776

doctrinebot opened this Issue · 3 comments

2 participants


Jira issue originally created by user stof:

When a listener resets an entity during onFlush and recompute the changeset (setting it to null as there is no changes), the following triggering of preUpdate fails as PreUpdateEventArgs would get null as third argument which is forbidden


Comment created by gediminasm:

Here is a test case:

use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Event\OnFlushEventArgs;

class DummyListener implements EventSubscriber
public function getSubscribedEvents()
return array('preUpdate', 'onFlush');

public function onFlush(OnFlushEventArgs $args)
    $uow = $args->getEntityManager()->getUnitOfWork();
    foreach ($uow->getScheduledEntityUpdates() as $object) {

public function preUpdate(PreUpdateEventArgs $args)


triggers fatal error


Comment created by @beberlei:

Only fixed in 2.1


Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.1 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.