Skip to content

Loading…

DDC-1177: Schema-tool generate entities Class inheritance child tables require primary key #1780

Closed
doctrinebot opened this Issue · 7 comments

2 participants

@doctrinebot

Jira issue originally created by user venimus:

got

Profiles:
  type: entity
  table: profiles
  repositoryClass: Repositories\Base
  inheritanceType: JOINED
  discriminatorColumn:
    name: profiletype
    type: integer
    length: 11
  discriminatorMap:
    1: Personal
    2: Work
    3: Business
  fields:
    id:
      id: true
      type: integer
      generator:
        strategy: IDENTITY
    firstname:
      type: string
      length: 255
      fixed: false
      nullable: true
    lastname:
      type: string
      length: 255
      fixed: false
      nullable: true
    email:
      type: string
      length: 255
      fixed: false
      nullable: true

and

Business:
  type: entity
  table: business
  repositoryClass: Repositories\Base
  fields:
    businessname:
      type: string
      length: 255
      fixed: false
      nullable: true

and also have

class Business extends Profiles
{
..
}

which should be the proper mapping

but still get

[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Business'. Every Entity must have an identifier/primary key.
@doctrinebot

Comment created by @beberlei:

Formatting

@doctrinebot

Comment created by @beberlei:

Your mapping is invalid.

Ids get a special section called "id:" and are not present in "fields":

please see the documentaiton for an example of a correct mapping.

@doctrinebot

Issue was closed with resolution "Invalid"

@doctrinebot

Comment created by venimus:

sorry to say that but in the current state the documentation is useless i still cannot find a correct mapping example for YAML i've read it tens of times from a to z

@doctrinebot

Comment created by birkestroem:

I have the same issue when using the cli tool and try to generate a single table inheritance. It renders the tool useless when using YAML. It makes no difference formatting the correct way as suggested.

Have anyone found a way around this problem?

@doctrinebot

Comment created by venimus:

@Jesper Birkestrøm I simply removed the check in the and it works. Btw I do not know when the id's section appeared, since I didn't made the {id:true} format myself I've seen it somewhere, however both declaration have the same problem and both work when removed the "id check"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.