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}
        Hide
        Benjamin Eberlei added a comment -

        This was fixed or something.

        Show
        Benjamin Eberlei added a comment - This was fixed or something.
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Nikolai Spassoff added a comment -

        The following hierarchy doesn't work after commit 5ff44b5ec75f6d716ec3.

        The thrown exception is:
        'Entity\AbstractMaschine' has to be part of the descriminator map of 'Entity\Inventory'

        Inventory is just a plain abstract class which contains the @Id field and a few methods used by all subclasses.

        Show
        Nikolai Spassoff added a comment - The following hierarchy doesn't work after commit 5ff44b5ec75f6d716ec3. The thrown exception is: 'Entity\AbstractMaschine' has to be part of the descriminator map of 'Entity\Inventory' Inventory is just a plain abstract class which contains the @Id field and a few methods used by all subclasses.
        Nikolai Spassoff made changes -
        Attachment graph.jpg [ 11020 ]
        Hide
        Benjamin Eberlei added a comment -

        Yes, please add it to the discriminator map, it is necessary for internal algorithms that this class is in the map.

        Show
        Benjamin Eberlei added a comment - Yes, please add it to the discriminator map, it is necessary for internal algorithms that this class is in the map.
        Hide
        Benjamin Eberlei added a comment -

        Ok this has been changed, its not necessary for abstract classes anymore.

        Show
        Benjamin Eberlei added a comment - Ok this has been changed, its not necessary for abstract classes anymore.
        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 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1203, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated:
              Resolved: