Symfony 条令@InheritanceType(“JOINED”)错误使用语句
我试图在条令中使用继承类型,但在创建数据库时,它会显示以下错误消息:Symfony 条令@InheritanceType(“JOINED”)错误使用语句,symfony,doctrine-orm,Symfony,Doctrine Orm,我试图在条令中使用继承类型,但在创建数据库时,它会显示以下错误消息: [Doctrine\Common\Annotations\AnnotationException] [Semantical Error] The annotation "@InheritanceType" in class iMed\GestInfo rmatiqueBundle\Entity\MaterielInformatique was never imported. Did you mayb e forget to a
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@InheritanceType" in class iMed\GestInfo
rmatiqueBundle\Entity\MaterielInformatique was never imported. Did you mayb
e forget to add a "use" statement for this annotation?
父类是
namespace iMed\GestInformatiqueBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* MaterielInformatique
*
* @ORM\Table(name="MATERIEL_INFORMATIQUE")
* @ORM\Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="nature", type="string")
* @DiscriminatorMap({"PCMP" = "PC", "IMPR" = "Imprimante", "ECRN" = "Ecran"})
*/
class MaterielInformatique
{
/**
* @var integer
*
* @ORM\Column(name="ID", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
////
}
似乎我需要添加一行来导入一个类,但我不知道该类是什么,有人有办法解决这个问题吗?您在
InheritanceType
命名空间中遗漏了ORM
前缀,请尝试以下操作:
/**
* MaterielInformatique
*
* @ORM\Table(name="MATERIEL_INFORMATIQUE")
* @ORM\Entity
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="nature", type="string")
* @ORM\DiscriminatorMap({"PCMP" = "PC", "IMPR" = "Imprimante", "ECRN" = "Ecran"})
*/
class MaterielInformatique