Search code examples
phpmysqldoctrine-ormtransactionssymfony-3.2

Doctrine transactions - count number of pending requests


Is there a way to find out the number of pending requests in a transaction before launching the commit action ?

I want to launch my commit only if I get a sufficient number of queries (that I can not count one by one before in my particular case...)


Solution

  • OK I find this in the UOF

    http://www.doctrine-project.org/api/orm/2.3/source-class-Doctrine.ORM.UnitOfWork.html#3134

    so this method will do the job

    count($em->getUnitOfWork()->getScheduledEntityInsertions())