Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1542

GH-221: [Inheritance] Joined: Default discriminator map

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      Pull-Request was automatically synchronized: https://github.com/doctrine/doctrine2/pull/221

      Hi all,

      I know this topic was discussed a lot of times, but I wanted to give it a try anyway.

      I want the discriminator map to be configured dynamically by doctrine instead of having to manually configure it myself. So I've digged into the code and the only place I've found (yet) to put the necessary code to make this happen is in the Drivers, just when they're loading the mapping information. So far, I've put a very simple piece of code in the AnnotationDriver to give it a try and I wrote a test for it. But before going on I wanted to ask you if it looks ok for you.

      I've tested it in an application I'm working on and, so far, it works.

      Two things come to mind though:

      1) Is there any special case this would cause problems that I don't know of?
      2) If not then, Is there a better place to put this code so I don't have to implement it in all drivers? I've been looking at the ClassMetadataFactory class but I didn't find a place to put this code because it seems it's too late to calculate the discriminator map at the time this class is used. So, in case there is no other place, where should I refactor the logic? It feels uncomfortable to create a class just to put this simple logic on, but as drivers don't inherit from any class, I don't see another option.

      Thanks!

        Activity

        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-221] was
        https://github.com/doctrine/doctrine2/pull/221

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-221] was https://github.com/doctrine/doctrine2/pull/221
        Hide
        Benjamin Eberlei added a comment -

        Mark as improvement and schedule for 2.3

        Show
        Benjamin Eberlei added a comment - Mark as improvement and schedule for 2.3

          People

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

            Dates

            • Created:
              Updated:
              Resolved: