The EntityManager is closed

前端 未结 17 1773
星月不相逢
星月不相逢 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:42

    I faced the same problem while testing the changes in Symfony 4.3.2

    I lowered the log level to INFO

    And ran the test again

    And the logged showed this:

    console.ERROR: Error thrown while running command "doctrine:schema:create". Message: "[Semantical Error] The annotation "@ORM\Id" in property App\Entity\Common::$id was never imported. Did you maybe forget to add a "use" statement for this annotation?" {"exception":"[object] (Doctrine\\Common\\Annotations\\AnnotationException(code: 0): [Semantical Error] The annotation \"@ORM\\Id\" in property App\\Entity\\Common::$id was never imported. Did you maybe forget to add a \"use\" statement for this annotation? at C:\\xampp\\htdocs\\dirty7s\\vendor\\doctrine\\annotations\\lib\\Doctrine\\Common\\Annotations\\AnnotationException.php:54)","command":"doctrine:schema:create","message":"[Semantical Error] The annotation \"@ORM\\Id\" in property App\\Entity\\Common::$id was never imported. Did you maybe forget to add a \"use\" statement for this annotation?"} []
    

    This means that some error in the code causes the:

    Doctrine\ORM\ORMException: The EntityManager is closed.
    

    So it is a good idea to check the log

提交回复
热议问题