Skip to content

Commit

Permalink
BUGFIX: Throw MappingException in loadMetaDataForClass
Browse files Browse the repository at this point in the history
When no class schema can be found in `loadMetaDataForClass`, a Doctrine
`MappingException` is now thrown. This makes our code work nicely with the
change in doctrine/orm#7471 that otherwise
leads to errors like this as of ORM 2.6.3:

```
FlowAnnotationDriver.php: No class schema found for "some-non-mapped-class".

89 …\FlowAnnotationDriver_Original::getClassSchema("some-non-mapped-class")
88 …\FlowAnnotationDriver_Original::loadMetadataForClass("some-non-mapped-class", Neos\Flow\Persistence\Doctrine\Mapping\ClassMetadata)
```

Fixes neos#1453
  • Loading branch information
kdambekalns authored Nov 21, 2018
1 parent bd031e8 commit df7dc0d
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,13 @@ public function loadMetadataForClass($className, ClassMetadata $metadata)
* @var ORM\ClassMetadata $metadata
*/

$class = $metadata->getReflectionClass();
$classSchema = $this->getClassSchema($class->getName());
$classAnnotations = $this->reader->getClassAnnotations($class);
try {
$class = $metadata->getReflectionClass();
$classSchema = $this->getClassSchema($class->getName());
$classAnnotations = $this->reader->getClassAnnotations($class);
} catch (ClassSchemaNotFoundException $exception) {
throw new ORM\MappingException(sprintf('Failure while fetching class schema class "%s": %s', $metadata->getName(), $exception->getMessage()), 1542792708, $exception);
}

// Evaluate Entity annotation
if (isset($classAnnotations[ORM\MappedSuperclass::class])) {
Expand Down

0 comments on commit df7dc0d

Please sign in to comment.