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

Closed
doctrinebot opened this Issue May 26, 2011 · 3 comments

2 participants

@doctrinebot

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

@doctrinebot

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) {
        $uow->clearEntityChangeSet(spl*object*hash($object));
    }
}

public function preUpdate(PreUpdateEventArgs $args)
{
    var_dump('invoked');
}

}

triggers fatal error

@doctrinebot

Comment created by @beberlei:

Only fixed in 2.1

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment