Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1203

Single Table Inheritance - Discriminator Column is not populated

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: Git Master
    • Fix Version/s: 2.1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      I have the following class inheritance; if I have the mapped super class in there, the discriminator column is not populated; if I remove it, it is correctly set.

      /**
       * @ORM\Entity
       * @ORM\Table(name = "a")
       * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
       * @ORM\InheritanceType("SINGLE_TABLE")
       * @ORM\DiscriminatorColumn(name="type", type="string", length=20)
       * @ORM\DiscriminatorMap({
       *     "c"   = "C",
       *     "d"   = "D"
       * })
       */
      abstract class A { }
      
      /**
       * @ORM\MappedSuperClass
       */
      abstract class B extends A { }
      
      /**
       * @ORM\Entity
       */
      class C extends B { }
      
      /**
       * @ORM\Entity
       */
      class D extends B { }
      

        Activity

        Johannes Schmitt created issue -
        Johannes Schmitt made changes -
        Field Original Value New Value
        Description I have the following class inheritance; if I have the mapped super class in there, the discriminator column is not populated; if I remove it, it is correctly set.

        /**
         * @ORM\Entity
         * @ORM\Table(name = "a")
         * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
         * @ORM\InheritanceType("SINGLE_TABLE")
         * @ORM\DiscriminatorColumn(name="type", type="string", length=20)
         * @ORM\DiscriminatorMap({
         * "c" = "C",
         * "d" = "D"
         * })
         */
        abstract class A { }

        /**
         * @ORM\MappedSuperClass
         */
        abstract class B extends A { }

        /**
         * @ORM\Entity
         */
        class C extends B { }

        /**
         * @ORM\Entity
         */
        class D extends B { }
        I have the following class inheritance; if I have the mapped super class in there, the discriminator column is not populated; if I remove it, it is correctly set.

        {code:java}
        /**
         * @ORM\Entity
         * @ORM\Table(name = "a")
         * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
         * @ORM\InheritanceType("SINGLE_TABLE")
         * @ORM\DiscriminatorColumn(name="type", type="string", length=20)
         * @ORM\DiscriminatorMap({
         * "c" = "C",
         * "d" = "D"
         * })
         */
        abstract class A { }

        /**
         * @ORM\MappedSuperClass
         */
        abstract class B extends A { }

        /**
         * @ORM\Entity
         */
        class C extends B { }

        /**
         * @ORM\Entity
         */
        class D extends B { }
        {code}
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Nikolai Spassoff made changes -
        Attachment graph.jpg [ 11020 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12708 ] jira-feedback [ 14898 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14898 ] jira-feedback2 [ 16762 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 16762 ] jira-feedback3 [ 19015 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Johannes Schmitt
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: