Skip to content

Loading…

DDC-483: DiscriminatorMap misbehaves when key are Integer #4987

Closed
doctrinebot opened this Issue · 2 comments

1 participant

@doctrinebot

Jira issue originally created by user ulf.thomas:

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 (isstring($key) || isint($key)) {
$array[$key] = $value[$key];
} else {
$array[] = $value[$key];
}

@doctrinebot

Comment created by romanb:

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

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-BETA1 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.