I defined a mapping for
/**
* Identite entity
* @ORM\Entity
* @ORM\Table(name="identite")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"identite" = "Identite","candidat" = "Candidat","consultant"="Consultant","staff"="Staff" })
*/
class Identite extends ObjetEtat{
/**
* @var integer
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="nomidentite", type="string", length=200, nullable=true)
*/
private $nomidentite;}
and I have the mapping of the super Class:
/**
* Identite entity
* @ORM\Entity
* @ORM\Table(name="objetetat")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discrimin", type="string")
* @ORM\DiscriminatorMap({"objetetat" = "ObjetEtat","identite" = "Sigmatis\SigBundle\Entity\Identites\Identite" })
*/
class ObjetEtat {
//put your code here
/**
* @var integer
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id; }
And this is the third level of my hierarchy :
/**
* Candidat entity
* @ORM\Entity
* @ORM\Table(name="candidat")
*/
class Candidat extends Identite {
}
After updating my schema : I don't find the field "discr " of my table Identite . Do I miss something ??
您应该将@ORM\\DiscriminatorColumn
和@ORM\\DiscriminatorMap
注释放在超类上,而不是子类上
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.