我正试图找出一种在Doctrine中扩展模型的方法。我有以下情况
卡片型号(基本型号):
Nos\CardBundle\Entity\Card:
type: entity
table: cards
inheritanceType: SINGLE_TABLE
discriminatorColumn:
name: card_type
type: string
discriminatorMap:
staff: Nos\StaffBundle\Entity\Staff
supplier: Nos\SupplierBundle\Entity\Supplier
id:
id:
id: true
type: integer
length: 11
generator:
strategy: AUTO
options:
unsigned: true
fields:
user_id:
type: integer
length: 11
nullable: true
options:
unsigned: true
card_display_name:
type: string
length: 255
nullable: false
我使用card_type属性区分模型。当它是'员工'时,它应该返回员工模型,当它是'供应商'时它应该返回供应商模型
员工模型(扩展卡片型号)
Nos\StaffBundle\Entity\Staff:
type: entity
inheritance:
extends: Nos\CardBundle\Entity\Card
type: simple
staff_initials:
type: string
length: 15
staff_baptismal_names:
type: string
length: 255
和供应商模型
Nos\StaffBundle\Entity\Supplier:
type: entity
inheritance:
extends: Nos\CardBundle\Entity\Card
type: simple
supplier_name:
type: string
length: 255
生成表格时,不会创建“供应商”和“员工”模型中的其他字段。我是否必须在卡片模型中定义其他字段?如果是这样,我怎样才能将它们排除在不属于它们的模型之外?