Skip to content

Loading…

DDC-2743: ORM not trowing exception when there is inheritance mapping and type's column's value is missing in discriminator map #3487

Open
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user cappy:

It will be good to throw exception otherwise I get

Warning: class_parents(): object or string expected in /Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php on line 40

Warning: array_reverse() expects parameter 1 to be array, boolean given in /Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php on line 257

Warning: Invalid argument supplied for foreach() in /Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php on line 257

This check will be good after line 235 in Doctrine\ORM\Internals\Hydration\ObjectHydrator:

if (empty($className)) {
throw HydrationException::emptyDiscriminatorMapValue($dqlAlias);
}

@doctrinebot

Comment created by @beberlei:

This can be validated in the ClassMetadataFactory. If you load a child, it will reverse the order of inheritance and start loading the mappings from the root first. The child is then loaded with the full discriminator map and should throw an error if its not in there.

@doctrinebot

Comment created by cordoval:

i am trying this with the basic group at hackingday

@beberlei beberlei was assigned by doctrinebot
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.