Skip to content

Commit

Permalink
Ensures discriminator map is case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
gquemener committed May 13, 2020
1 parent 7fe1454 commit 476a1c6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Expand Up @@ -30,6 +30,7 @@
use Doctrine\ORM\Id\BigIntegerIdentityGenerator;
use Doctrine\ORM\Id\IdentityGenerator;
use Doctrine\ORM\ORMException;
use ReflectionClass;
use ReflectionException;
use function assert;

Expand Down Expand Up @@ -276,6 +277,11 @@ protected function validateRuntimeMetadata($class, $parent)
if ( ! $class->discriminatorColumn) {
throw MappingException::missingDiscriminatorColumn($class->name);
}
foreach ($class->subClasses as $subClass) {
if ((new ReflectionClass($subClass))->name !== $subClass) {
throw MappingException::invalidClassInDiscriminatorMap($subClass, $class->name);
}
}
}
} else if ($class->isMappedSuperclass && $class->name == $class->rootEntityName && (count($class->discriminatorMap) || $class->discriminatorColumn)) {
// second condition is necessary for mapped superclasses in the middle of an inheritance hierarchy
Expand Down

0 comments on commit 476a1c6

Please sign in to comment.