教义不是有效的实体或映射的超类 [英] Doctrine Is not a valid entity or mapped super class
本文介绍了教义不是有效的实体或映射的超类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的学说有问题,我从自动生成的实体文件类用户"不是有效的实体或映射的超类"中得到了此错误.里面的文件和注释看起来不错,我不理解为什么还是我错过了一些事情?一些代码
i have a problem with doctrine and i getting this error from auto generated entity file "Class "Users" is not a valid entity or mapped super class.". File and comments inside looks like fine i dont understund why or i something miss? Some piece of code
<?php
use Doctrine\ORM\Mapping as ORM;
/**
* Users
*
* @ORM\Table(name="users", uniqueConstraints={@ORM\UniqueConstraint(name="username", columns={"username"})})
* @ORM\Entity
*/
class Users
{
/**
* @var integer
*
* @ORM\Column(name="userid", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $userid;
/**
* @var string
*
* @ORM\Column(name="username", type="string", length=100, nullable=false)
*/
private $username;
推荐答案
对我来说,添加以下名称空间后,此问题已解决
for me this problem was solved after adding following namespace
use Doctrine\Common\Annotations\AnnotationReader;
在我的doctrine.php中
in my doctrine.php
这篇关于教义不是有效的实体或映射的超类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文