我有这个结构
`UserInterface.php`
abstract class User implements UserInterfacee in model`
`class student extends user.php`
`class teacher extends user.php`
现在我应该在哪个课程中使用这个学说代码
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"user" = "User", "student" = "Student"})
*/
答案 0 :(得分:2)
您应该在父类中使用继承注释。
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"student" = "Student", "teacher" = "Teacher"})
*/
class User
{
// ...
}
/** @Entity */
class Student extends User
{
// ...
}
/** @Entity */
class Teacher extends User
{
// ...
}