Answer the question
In order to leave comments, you need to log in
What is a discriminator column in doctrine?
Hello!
I'm trying to make an extension orm. But when inserting, the doctrine persistently tries to add a discriminator column to the database. Can someone explain why it is needed at all? And what is the right way to describe it?
AppBundle\Entity\BuildingObjectSuper:
type: mappedSuperclass
table: object
fields:
titleObject:
type: text
nullable: false
length: 16777215
options:
fixed: false
column: title_object
KRBundle\Entity\BuildingObject:
type: entity
inheritanceType: SINGLE_TABLE
discriminatorColumn:
name: titleObject
type: string
table: object
repositoryClass: KRBundle\Repository\BuildingObjectRepository
fields:
other:
type: integer
nullable: true
Column not found: 1054 Unknown column 'titleObject' in 'field list'
Duplicate definition of column 'column_name' on entity 'KRBundle\Entity\BuildingObject' in a field or discriminator column mapping.if you specify an existing field
Answer the question
In order to leave comments, you need to log in
If you do just MappedSuperclass - then you don't need DiscriminatorColumn, you need it for other purposes
docs.doctrine-project.org/projects/doctrine-orm/en... The
DiscriminatorColumn is added automatically, it doesn't need to be declared in the entity
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question