DDC-3218: Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given #3986

Closed
opened 2026-01-22 14:32:57 +01:00 by admin · 20 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 18, 2014).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user lyrixx:

{quote}
Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::**construct() must be of the type array, null given, called in /home/greg/dev/product/insight/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined

Stack trace:

[1] PHPUnit_Framework_Error: Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given, called in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined
at n/a
in /project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47

at PHPUnit*Util_ErrorHandler::handleError('4096', 'Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::_*construct() must be of the type array, null given, called in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined', '/project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php', '47', array('entity' => object(Violation), 'em' => object(EntityManager)))
    in /project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47

at Doctrine\ORM\Event\PreUpdateEventArgs->**construct(object(Violation), object(EntityManager), null)
    in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 1009

at Doctrine\ORM\UnitOfWork->executeUpdates(object(ClassMetadata))
    in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 341

at Doctrine\ORM\UnitOfWork->commit(null)
    in /project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 389

at Doctrine\ORM\EntityManager->flush()
    in /project/src/SensioLabs/Bundle/MyBundle/Controller/MyController.php line 127

at SensioLabs\Bundle\MyBundle\Controller\MyController->ignoreAction(object(Request), object(Project), object(Analysis), '4')
    in  line 

at call*user_func*array(array(object(MyController), 'ignoreAction'), array(object(Request), object(Project), object(Analysis), '4'))
    in /project/app/bootstrap.php.cache line 1043

at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
    in /project/app/bootstrap.php.cache line 1015

at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
    in /project/app/bootstrap.php.cache line 1154

at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
    in /project/app/bootstrap.php.cache line 435

at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
    in /project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php line 81

at Symfony\Component\HttpKernel\Client->doRequest(object(Request))
    in /project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php line 111

at Symfony\Bundle\FrameworkBundle\Client->doRequest(object(Request))
    in /project/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php line 319

at Symfony\Component\BrowserKit\Client->request('POST', '/projects/id-foo/analyses/2/rule/4/ignore', array('ignore*rule' => array('comment' => 'Message about why this rule has been ignored', '*token' => 'CxEFTSv4GZQSWYXtRt-eHybaML4z8I0WK1DHiwr8Ih0')))
    in /project/src/SensioLabs/Bundle/MyBundle/Test/Client.php line 489

at SensioLabs\Bundle\MyBundle\Test\Client->ignoreRuleViolations('id-foo', '2', '4', false)
    in /project/src/SensioLabs/Bundle/MyBundle/Tests/Acceptance/ViolationCommentsTest.php line 217

at SensioLabs\Bundle\MyBundle\Tests\Acceptance\ViolationCommentsTest->testDashboardWithCriticalIgnoredRules()
    in  line 

at ReflectionMethod->invokeArgs(object(ViolationCommentsTest), array())
    in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 951

at PHPUnit*Framework*TestCase->runTest()
    in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 817

at PHPUnit*Framework*TestCase->runBare()
    in /project/vendor/phpunit/phpunit/src/Framework/TestResult.php line 686

at PHPUnit*Framework*TestResult->run(object(ViolationCommentsTest))
    in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 753

at PHPUnit*Framework_TestCase->run(object(PHPUnit_Framework*TestResult))
    in /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php line 675

at PHPUnit*Framework_TestSuite->run(object(PHPUnit_Framework*TestResult))
    in /project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php line 426

at PHPUnit*TextUI_TestRunner->doRun(object(PHPUnit_Framework*TestSuite), array('listGroups' => false, 'loader' => null, 'useDefaultConfiguration' => true, 'configuration' => '/project/app/phpunit.xml.dist', 'filter' => 'testDashboardWithCriticalIgnoredRules', 'testSuffixes' => array('Test.php', '.phpt')))
    in /opt/dotfiles/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php line 176

at PHPUnit*TextUI*Command->run(array('/usr/local/bin/phpunit', '-c', 'app/', '--filter', 'testDashboardWithCriticalIgnoredRules', 'src/SensioLabs/Bundle/MyBundle/Tests/Acceptance/ViolationCommentsTest.php'), true)
    in /opt/dotfiles/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php line 129

at PHPUnit*TextUI*Command::main()
    in /opt/dotfiles/vendor/phpunit/phpunit/composer/bin/phpunit line 63

{quote}

I fails in this code

    private function executeUpdates($class)
    {
        $className          = $class->name;
        $persister          = $this->getEntityPersister($className);
        $preUpdateInvoke    = $this->listenersInvoker->getSubscribedSystems($class, Events::preUpdate);
        $postUpdateInvoke   = $this->listenersInvoker->getSubscribedSystems($class, Events::postUpdate);

        foreach ($this->entityUpdates as $oid => $entity) {
            if ($this->em->getClassMetadata(get_class($entity))->name !== $className) {
                continue;
            }

            if ($preUpdateInvoke != ListenersInvoker::INVOKE_NONE) {
// => this line
                $this->listenersInvoker->invoke($class, Events::preUpdate, $entity, new PreUpdateEventArgs($entity, $this->em, $this->entityChangeSets[$oid]), $preUpdateInvoke);
                $this->recomputeSingleEntityChangeSet($class, $entity);
            }

            if ( ! empty($this->entityChangeSets[$oid])) {
                $persister->update($entity);
            }

            unset($this->entityUpdates[$oid]);

            if ($postUpdateInvoke != ListenersInvoker::INVOKE_NONE) {
                $this->listenersInvoker->invoke($class, Events::postUpdate, $entity, new LifecycleEventArgs($entity, $this->em), $postUpdateInvoke);
            }
        }
    }
Originally created by @doctrinebot on GitHub (Jul 18, 2014). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user lyrixx: {quote} Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::**construct() must be of the type array, null given, called in /home/greg/dev/product/insight/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined Stack trace: [1] PHPUnit_Framework_Error: Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given, called in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined at n/a in /project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47 ``` at PHPUnit*Util_ErrorHandler::handleError('4096', 'Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::_*construct() must be of the type array, null given, called in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1009 and defined', '/project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php', '47', array('entity' => object(Violation), 'em' => object(EntityManager))) in /project/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47 at Doctrine\ORM\Event\PreUpdateEventArgs->**construct(object(Violation), object(EntityManager), null) in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 1009 at Doctrine\ORM\UnitOfWork->executeUpdates(object(ClassMetadata)) in /project/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 341 at Doctrine\ORM\UnitOfWork->commit(null) in /project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 389 at Doctrine\ORM\EntityManager->flush() in /project/src/SensioLabs/Bundle/MyBundle/Controller/MyController.php line 127 at SensioLabs\Bundle\MyBundle\Controller\MyController->ignoreAction(object(Request), object(Project), object(Analysis), '4') in line at call*user_func*array(array(object(MyController), 'ignoreAction'), array(object(Request), object(Project), object(Analysis), '4')) in /project/app/bootstrap.php.cache line 1043 at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1') in /project/app/bootstrap.php.cache line 1015 at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true) in /project/app/bootstrap.php.cache line 1154 at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true) in /project/app/bootstrap.php.cache line 435 at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) in /project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php line 81 at Symfony\Component\HttpKernel\Client->doRequest(object(Request)) in /project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php line 111 at Symfony\Bundle\FrameworkBundle\Client->doRequest(object(Request)) in /project/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php line 319 at Symfony\Component\BrowserKit\Client->request('POST', '/projects/id-foo/analyses/2/rule/4/ignore', array('ignore*rule' => array('comment' => 'Message about why this rule has been ignored', '*token' => 'CxEFTSv4GZQSWYXtRt-eHybaML4z8I0WK1DHiwr8Ih0'))) in /project/src/SensioLabs/Bundle/MyBundle/Test/Client.php line 489 at SensioLabs\Bundle\MyBundle\Test\Client->ignoreRuleViolations('id-foo', '2', '4', false) in /project/src/SensioLabs/Bundle/MyBundle/Tests/Acceptance/ViolationCommentsTest.php line 217 at SensioLabs\Bundle\MyBundle\Tests\Acceptance\ViolationCommentsTest->testDashboardWithCriticalIgnoredRules() in line at ReflectionMethod->invokeArgs(object(ViolationCommentsTest), array()) in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 951 at PHPUnit*Framework*TestCase->runTest() in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 817 at PHPUnit*Framework*TestCase->runBare() in /project/vendor/phpunit/phpunit/src/Framework/TestResult.php line 686 at PHPUnit*Framework*TestResult->run(object(ViolationCommentsTest)) in /project/vendor/phpunit/phpunit/src/Framework/TestCase.php line 753 at PHPUnit*Framework_TestCase->run(object(PHPUnit_Framework*TestResult)) in /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php line 675 at PHPUnit*Framework_TestSuite->run(object(PHPUnit_Framework*TestResult)) in /project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php line 426 at PHPUnit*TextUI_TestRunner->doRun(object(PHPUnit_Framework*TestSuite), array('listGroups' => false, 'loader' => null, 'useDefaultConfiguration' => true, 'configuration' => '/project/app/phpunit.xml.dist', 'filter' => 'testDashboardWithCriticalIgnoredRules', 'testSuffixes' => array('Test.php', '.phpt'))) in /opt/dotfiles/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php line 176 at PHPUnit*TextUI*Command->run(array('/usr/local/bin/phpunit', '-c', 'app/', '--filter', 'testDashboardWithCriticalIgnoredRules', 'src/SensioLabs/Bundle/MyBundle/Tests/Acceptance/ViolationCommentsTest.php'), true) in /opt/dotfiles/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php line 129 at PHPUnit*TextUI*Command::main() in /opt/dotfiles/vendor/phpunit/phpunit/composer/bin/phpunit line 63 ``` {quote} I fails in this code ``` private function executeUpdates($class) { $className = $class->name; $persister = $this->getEntityPersister($className); $preUpdateInvoke = $this->listenersInvoker->getSubscribedSystems($class, Events::preUpdate); $postUpdateInvoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postUpdate); foreach ($this->entityUpdates as $oid => $entity) { if ($this->em->getClassMetadata(get_class($entity))->name !== $className) { continue; } if ($preUpdateInvoke != ListenersInvoker::INVOKE_NONE) { // => this line $this->listenersInvoker->invoke($class, Events::preUpdate, $entity, new PreUpdateEventArgs($entity, $this->em, $this->entityChangeSets[$oid]), $preUpdateInvoke); $this->recomputeSingleEntityChangeSet($class, $entity); } if ( ! empty($this->entityChangeSets[$oid])) { $persister->update($entity); } unset($this->entityUpdates[$oid]); if ($postUpdateInvoke != ListenersInvoker::INVOKE_NONE) { $this->listenersInvoker->invoke($class, Events::postUpdate, $entity, new LifecycleEventArgs($entity, $this->em), $postUpdateInvoke); } } } ```
admin added the Bug label 2026-01-22 14:32:57 +01:00
admin closed this issue 2026-01-22 14:32:57 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 18, 2014):

Comment created by @ocramius:

Requires a test case

@doctrinebot commented on GitHub (Jul 18, 2014): Comment created by @ocramius: Requires a test case
Author
Owner

@doctrinebot commented on GitHub (Aug 26, 2014):

Comment created by bocharsky.bw:

I have same bug when call flush() method from entity manager in my few event listeners in Symfony.

P.S. If I call flush() only from one listener - it works well, but when call flush() in first, and then in second - it fails. And it does not matter in which order listeners are called.

@doctrinebot commented on GitHub (Aug 26, 2014): Comment created by bocharsky.bw: I have same bug when call flush() method from entity manager in my few event listeners in Symfony. P.S. If I call flush() only from one listener - it works well, but when call flush() in first, and then in second - it fails. And it does not matter in which order listeners are called.
Author
Owner

@doctrinebot commented on GitHub (Aug 26, 2014):

Comment created by lyrixx:

yeah, the bug occurs in the same circumstance as described by victor.
(sorry for the delay, and sorry to not provider a test case)

@doctrinebot commented on GitHub (Aug 26, 2014): Comment created by lyrixx: yeah, the bug occurs in the same circumstance as described by victor. (sorry for the delay, and sorry to not provider a test case)
Author
Owner

@doctrinebot commented on GitHub (Aug 26, 2014):

Comment created by stof:

Calling flush() inside a Doctrine listener is not a supported Doctrine usage. it means you are trying to nest several flushes inside each other, which can indeed break the unit of work

@doctrinebot commented on GitHub (Aug 26, 2014): Comment created by stof: Calling flush() inside a Doctrine listener is not a supported Doctrine usage. it means you are trying to nest several flushes inside each other, which can indeed break the unit of work
Author
Owner

@doctrinebot commented on GitHub (Aug 26, 2014):

Comment created by lyrixx:

I refactored this part of our code base, to remove all flush from the listener. Everything works right now.
But I did not know this was not possible. (And it's not me the guy who created this ****** in our codebase ;))

@doctrinebot commented on GitHub (Aug 26, 2014): Comment created by lyrixx: I refactored this part of our code base, to remove all flush from the listener. Everything works right now. But I did not know this was not possible. (And it's not me the guy who created this *****\* in our codebase ;))
Author
Owner

@doctrinebot commented on GitHub (Aug 26, 2014):

Comment created by bocharsky.bw:

So, for example, if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener?
Is it will be fixed or it's a normal behavior of Doctrine?

@doctrinebot commented on GitHub (Aug 26, 2014): Comment created by bocharsky.bw: So, for example, if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener? Is it will be fixed or it's a normal behavior of Doctrine?
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2015):

Comment created by charlie_wasp:

I ran into the same issue, I wonder, what should I do?

if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener?

Is there an answer on this?

@doctrinebot commented on GitHub (Feb 9, 2015): Comment created by charlie_wasp: I ran into the same issue, I wonder, what should I do? <cite>if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener</cite>? Is there an answer on this?
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2015):

Comment created by @ocramius:

Flushing in a listener that acts during EntityManagerInterface#flush() is disallowed.

@doctrinebot commented on GitHub (Feb 9, 2015): Comment created by @ocramius: Flushing in a listener that acts during `EntityManagerInterface#flush()` is disallowed.
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2015):

Comment created by @ocramius:

I'm marking this issue as incomplete: not reproducible without a test case.

@doctrinebot commented on GitHub (Feb 9, 2015): Comment created by @ocramius: I'm marking this issue as incomplete: not reproducible without a test case.
Author
Owner

@doctrinebot commented on GitHub (Feb 9, 2015):

Issue was closed with resolution "Incomplete"

@doctrinebot commented on GitHub (Feb 9, 2015): Issue was closed with resolution "Incomplete"
Author
Owner

@doctrinebot commented on GitHub (May 27, 2015):

Comment created by Wirone:

I'm facing this problem right now (doctrine/orm 2.5).

In my case:

  • We have listener for one specified entity's field, which subscribes to preUpdate, postPersist and postUpdate
  • in preUpdate we check if this is valid entity and old value of specified field differs from new value, if yes we internally store some array with data like below:
[
'mode' => 'manual',
'entity' => $entity,
'oldValue' => $oldValue,
'newValue' => $newValue,
]
  • in postPersist (works ok) and postUpdate (ContextErrorException) we're using custom logger, which has handler based on database, for storing changelog record. We create new entity, which has relation to modified entity. Exception rises when flushing changelog entity, which again dispatches preUpdate on related entity with null 3rd argument.

I can't post more code because it's company's property, but flow is described and clear (I think so).

@doctrinebot commented on GitHub (May 27, 2015): Comment created by Wirone: I'm facing this problem right now (doctrine/orm 2.5). In my case: - We have listener for one specified entity's field, which subscribes to `preUpdate`, `postPersist` and `postUpdate` - in `preUpdate` we check if this is valid entity and old value of specified field differs from new value, if yes we internally store some array with data like below: ``` [ 'mode' => 'manual', 'entity' => $entity, 'oldValue' => $oldValue, 'newValue' => $newValue, ] ``` - in `postPersist` (works ok) and `postUpdate` (`ContextErrorException`) we're using custom logger, which has handler based on database, for storing changelog record. We create new entity, which has relation to modified entity. Exception rises when flushing changelog entity, which again dispatches `preUpdate` on related entity with `null` 3rd argument. I can't post more code because it's company's property, but flow is described and clear (I think so).
Author
Owner

@doctrinebot commented on GitHub (May 27, 2015):

Comment created by @ocramius:

That's not enough to reproduce the problem. From what I am thinking, this looks like a case where flush() was called (again) in a listener (unsupported).

I suggest you to write a test case, if this is still valid.

@doctrinebot commented on GitHub (May 27, 2015): Comment created by @ocramius: That's not enough to reproduce the problem. From what I am thinking, this looks like a case where `flush()` was called (again) in a listener (unsupported). I suggest you to write a test case, if this is still valid.
Author
Owner

@doctrinebot commented on GitHub (May 27, 2015):

Comment created by Wirone:

Yes, flush() was called in postUpdate.. I've changed it to connection's insert() and now it works. Too bad it's unsupported (and not intuitive).

@doctrinebot commented on GitHub (May 27, 2015): Comment created by Wirone: Yes, `flush()` was called in `postUpdate`.. I've changed it to connection's `insert()` and now it works. Too bad it's unsupported (and not intuitive).
Author
Owner

@doctrinebot commented on GitHub (May 28, 2015):

Comment created by dalexandre:

Would be a good idea to throw a real exception when trying to flush in a flush; Making this mistake better known.

@doctrinebot commented on GitHub (May 28, 2015): Comment created by dalexandre: Would be a good idea to throw a real exception when trying to flush in a flush; Making this mistake better known.
Author
Owner

@JarJak commented on GitHub (May 17, 2016):

"Would be a good idea to throw a real exception when trying to flush in a flush; Making this mistake better known."

I came to the same issue today, throwing that exception would help a lot in debugging.

@JarJak commented on GitHub (May 17, 2016): "Would be a good idea to throw a real exception when trying to flush in a flush; Making this mistake better known." I came to the same issue today, throwing that exception would help a lot in debugging.
Author
Owner

@galeaspablo commented on GitHub (Jul 15, 2016):

Comment created by charlie_wasp:

I ran into the same issue, I wonder, what should I do?

if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener?

Is there an answer on this?

Yes there is, make the changes using DQL. If you use flush inside your listener, you'll get the flush process started again, and then more listeners. I'm guessing this recursion is why this isn't supported.

EDIT: You can also create an impediment for the flush to act recursively. By ensuring it's only run when a field has changed in PreUpdate. OR if you're using Symfony, use PostFlush as described in this SO - http://stackoverflow.com/questions/16904462/adding-additional-persist-calls-to-preupdate-call-in-symfony-2-1#answer-16906067

@galeaspablo commented on GitHub (Jul 15, 2016): > Comment created by charlie_wasp: > > I ran into the same issue, I wonder, what should I do? > > if I use postUpdate Doctrine event to modify the entity after save them to DB, I can't save additional changes to DB again with flush() in my listener? > > Is there an answer on this? Yes there is, make the changes using DQL. If you use flush inside your listener, you'll get the flush process started again, and then more listeners. I'm guessing this recursion is why this isn't supported. EDIT: You can also create an impediment for the flush to act recursively. By ensuring it's only run when a field has changed in PreUpdate. OR if you're using Symfony, use PostFlush as described in this SO - http://stackoverflow.com/questions/16904462/adding-additional-persist-calls-to-preupdate-call-in-symfony-2-1#answer-16906067
Author
Owner

@Ocramius commented on GitHub (Jul 15, 2016):

Nested flushes are indeed not supported. If anybody wants to give a stab at a nesting check exception+guard, feel free to do so.

@Ocramius commented on GitHub (Jul 15, 2016): Nested flushes are indeed not supported. If anybody wants to give a stab at a nesting check exception+guard, feel free to do so.
Author
Owner

@Glideh commented on GitHub (Oct 26, 2016):

I have a Log entity which tracks changes in an Item entity.
I need to know what changed each time Item is created, updated, deleted.
I have an ItemListener entity listener taking care of my Item, I can't use PostFlush from here.
How should I track the changes from my ItemListener ?

@Glideh commented on GitHub (Oct 26, 2016): I have a `Log` entity which tracks changes in an `Item` entity. I need to know what changed each time `Item` is created, updated, deleted. I have an `ItemListener` entity listener taking care of my `Item`, I can't use `PostFlush` from here. How should I track the changes from my `ItemListener` ?
Author
Owner

@Glideh commented on GitHub (Oct 26, 2016):

It seems not possible with an EntityListener.
I used a standard listener with onFlush to track all the updates.

@Glideh commented on GitHub (Oct 26, 2016): It seems not possible with an EntityListener. I used a standard listener with `onFlush` to track all the updates.
Author
Owner

@riki137 commented on GitHub (Jun 5, 2017):

Same problem here. Any way to find out if we're already in a flush?

@riki137 commented on GitHub (Jun 5, 2017): Same problem here. Any way to find out if we're already in a flush?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3986