Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1177

Schema-tool generate entities Class inheritance child tables require primary key

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.x
    • Fix Version/s: None
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      Yaml mapping, Doctrine 2.0.5

      Description

      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.
      

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Formatting

        Show
        Benjamin Eberlei added a comment - Formatting
        Hide
        Benjamin Eberlei added a comment -

        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.

        Show
        Benjamin Eberlei added a comment - 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.
        Hide
        venimus added a comment -

        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

        Show
        venimus added a comment - 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
        Show
        Benjamin Eberlei added a comment - That one shows it: http://www.doctrine-project.org/docs/orm/2.0/en/reference/yaml-mapping.html#example
        Hide
        Jesper Birkestrøm added a comment -

        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?

        Show
        Jesper Birkestrøm added a comment - 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?
        Hide
        venimus added a comment -

        @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"

        Show
        venimus added a comment - @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"

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            venimus
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: