Doctrine2 - “class” is not a valid entity or mapped super class

后端 未结 5 2068
庸人自扰
庸人自扰 2020-12-05 06:42

I get exception Uncaught exception \'Doctrine\\ORM\\Mapping\\MappingException\' with message \'Class \"Users\" is not a valid entity or mapped super class every

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 07:24

    Following to Ocramius's answer (which saved me as well)

    If you've got some custom namespacing on your Entities make sure that the annotations come after the namespace decleration, here is my Entity that worked:

    Then in my controller:

       $entityManager->find('App\Models\Books', 1)
    

    Success!

提交回复
热议问题