The EntityManager is closed

前端 未结 17 1795
星月不相逢
星月不相逢 2020-11-29 18:36
[Doctrine\\ORM\\ORMException]   
The EntityManager is closed.  

After I get a DBAL exception when inserting data, EntityManager closes and I\'m not

17条回答
  •  广开言路
    2020-11-29 18:46

    For what it's worth I found this issue was happening in a batch import command because of a try/catch loop catching an SQL error (with em->flush()) that I didn't do anything about. In my case it was because I was trying to insert a record with a non-nullable property left as null.

    Typically this would cause a critical exception to happen and the command or controller to halt, but I was just logging this problem instead and carrying on. The SQL error had caused the entity manager to close.

    Check your dev.log file for any silly SQL errors like this as it could be your fault. :)

提交回复
热议问题