Sylius: Payum "The EntityManager is closed"

Created on 27 Jun 2016  ·  5Comments  ·  Source: Sylius/Sylius

Hi all,

I'm trying to setup payment through Payment Express (which is supported by the Payum through the Omnipay gateway). I've setup the proper config and everything, when capturing the card at the end of the cart flow the payment gets through to Payment Express but I end up with an error on the /payment/capture/{token} page. The exception says The EntityManager is closed..

I've tried using Stripe Direct (also through the Omnipay gateway) and that one works fine.

Any idea why I would be getting this error after the payment was received by the payment provider successfully?

Stacktrace for completeness:

[1] Doctrine\ORM\ORMException: The EntityManager is closed.
    at n/a
        in /vagrant/website/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php line 129

    at Doctrine\ORM\ORMException::entityManagerClosed()
        in /vagrant/website/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 708

    at Doctrine\ORM\EntityManager->errorIfClosed()
        in /vagrant/website/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 544

    at Doctrine\ORM\EntityManager->persist(object(Payment))
        in /vagrant/website/vendor/payum/payum/src/Payum/Core/Bridge/Doctrine/Storage/DoctrineStorage.php line 47

    at Payum\Core\Bridge\Doctrine\Storage\DoctrineStorage->doUpdateModel(object(Payment))
        in /vagrant/website/vendor/payum/payum/src/Payum/Core/Storage/AbstractStorage.php line 44

    at Payum\Core\Storage\AbstractStorage->update(object(Payment))
        in /vagrant/website/vendor/payum/payum/src/Payum/Core/Extension/StorageExtension.php line 72

    at Payum\Core\Extension\StorageExtension->onPostExecute(object(Context))
        in /vagrant/website/vendor/payum/payum/src/Payum/Core/Extension/ExtensionCollection.php line 51

    at Payum\Core\Extension\ExtensionCollection->onPostExecute(object(Context))
        in /vagrant/website/vendor/payum/payum/src/Payum/Core/Gateway.php line 129

    at Payum\Core\Gateway->execute(object(Capture))
        in /vagrant/website/vendor/payum/payum-bundle/Controller/CaptureController.php line 35

    at Payum\Bundle\PayumBundle\Controller\CaptureController->doAction(object(Request))
        in  line 

    at call_user_func_array(array(object(CaptureController), 'doAction'), array(object(Request)))
        in /vagrant/website/app/bootstrap.php.cache line 3192

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

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

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

    at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
        in /vagrant/website/web/app_dev.php line 14
Potential Bug

Most helpful comment

All 5 comments

Had this error on my own payment gateway.

In my case, that was because i created an embed entity into "payment" entity. I had to initialize embeded entity into my payment constructor in order to "update" and not "create" that entity....

Before, I tried every solutions to reset entityManager, without success.

Maybe that can helps to find why.

maybe @makasim can helps on that one.

I created an issue on Payum, closing here

Thanks @makasim for fixing and @kielabokkie for reporting!

I had a very similar issue today. At first, the details column on the Payment table was a varchar(255), so I changed it to TEXT and got rid of this problem.

Just thought of writing it down since it could happen to someone else.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ping86 picture ping86  ·  3Comments

igormukhingmailcom picture igormukhingmailcom  ·  3Comments

stefandoorn picture stefandoorn  ·  3Comments

eb22fbb4 picture eb22fbb4  ·  3Comments

mezoni picture mezoni  ·  3Comments