DDC-1050: Schema tool seems to have problems with mappedSuperClasses and subclasses with SINGLE_TABLE inheritance type #1308

Open
opened 2026-01-22 13:09:40 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 27, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user sebastian.hoitz:

I have a class App_Model_Contact_Attribute:

App*Model_Contact*Attribute:
  type: mappedSuperclass
  inheritanceType: SINGLE_TABLE
  table: contact_attribute
  discriminatorColumn:
    name: type
    type: string
    length: 20
    columnDefinition: "varchar(20) not null"
  discriminatorMap:
      emailAddress: App*Model_Contact*EmailAddress
      twitterAccount: App*Model_Contact*TwitterAccount
  id:
    id:
      type: integer
      columnDefinition: "int unsigned not null auto_increment"
      generator:
        strategy: AUTO
  fields:
    value:
      type: string
      notnull: true
      columnDefinition: "varchar(45)"
  manyToOne:
    contact:
      joinColumn:
        name: contactID
        referencedColumnName: id
        columnDefinition: "int not null unsigned"
      targetEntity: App*Model*Contact
      fetch: EAGER
      cascade: [persist]

and a class App_Model_Contact_EmailAddress and App_Model_Contact_TwitterAccount. Both yml files look similar to this:

App*Model_Contact*TwitterAccount:
  type: entity

Now, when I want to execute migrations:diff it always fails giving me the message: "Table contact_attribute already exists".

This probably has to do with the mappedSuperClass declaration in my models.

Originally created by @doctrinebot on GitHub (Feb 27, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user sebastian.hoitz: I have a class App_Model_Contact_Attribute: ``` App*Model_Contact*Attribute: type: mappedSuperclass inheritanceType: SINGLE_TABLE table: contact_attribute discriminatorColumn: name: type type: string length: 20 columnDefinition: "varchar(20) not null" discriminatorMap: emailAddress: App*Model_Contact*EmailAddress twitterAccount: App*Model_Contact*TwitterAccount id: id: type: integer columnDefinition: "int unsigned not null auto_increment" generator: strategy: AUTO fields: value: type: string notnull: true columnDefinition: "varchar(45)" manyToOne: contact: joinColumn: name: contactID referencedColumnName: id columnDefinition: "int not null unsigned" targetEntity: App*Model*Contact fetch: EAGER cascade: [persist] ``` and a class App_Model_Contact_EmailAddress and App_Model_Contact_TwitterAccount. Both yml files look similar to this: ``` App*Model_Contact*TwitterAccount: type: entity ``` Now, when I want to execute migrations:diff it always fails giving me the message: "Table contact_attribute already exists". This probably has to do with the mappedSuperClass declaration in my models.
admin added the Bug label 2026-01-22 13:09:40 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1308