Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-483

DiscriminatorMap misbehaves when key are Integer

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-ALPHA4
    • Fix Version/s: 2.0-BETA1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Doctrine 2.0 - ALPHA 4

      Description

      When in a Class-Inheritance Scenario @DiscriminatorMap is set like "@DiscriminatorMap(

      {2="Class1", 4="Class2"}

      )" (DiscriminatorColumn is of type Integer) then EntityManager->find('Class2', 'key)->will return an object of type Class1.

      I hunted down the bug to Doctrine/Common/Annotations/Parser.php (Line: 412):

      if (is_string($key)) {
      $array[$key] = $value[$key];
      } else {
      $array[] = $value[$key];
      }

      should be:

      if (is_string($key) || is_int($key)) {
      $array[$key] = $value[$key];
      } else {
      $array[] = $value[$key];
      }

        Activity

        Hide
        Roman S. Borschel added a comment -

        Should be fixed now (differently than you suggested though, because that broke other functionality).

        Show
        Roman S. Borschel added a comment - Should be fixed now (differently than you suggested though, because that broke other functionality).

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Ulf Thomas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: