Skip to content

Commit

Permalink
DDC-752 - Moved verify inheritance block behind the loadMetadata event
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Aug 28, 2010
1 parent c77a12a commit 33d0bb4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Expand Up @@ -302,16 +302,6 @@ protected function loadMetadata($name)
$this->completeIdGeneratorMapping($class);
}

// verify inheritance
if (!$parent && !$class->isMappedSuperclass && !$class->isInheritanceTypeNone()) {
if (count($class->discriminatorMap) == 0) {
throw MappingException::missingDiscriminatorMap($class->name);
}
if (!$class->discriminatorColumn) {
throw MappingException::missingDiscriminatorColumn($class->name);
}
}

if ($parent && $parent->isInheritanceTypeSingleTable()) {
$class->setPrimaryTable($parent->table);
}
Expand All @@ -323,6 +313,16 @@ protected function loadMetadata($name)
$this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
}

// verify inheritance
if (!$parent && !$class->isMappedSuperclass && !$class->isInheritanceTypeNone()) {
if (count($class->discriminatorMap) == 0) {
throw MappingException::missingDiscriminatorMap($class->name);
}
if (!$class->discriminatorColumn) {
throw MappingException::missingDiscriminatorColumn($class->name);
}
}

$this->loadedMetadata[$className] = $class;

$parent = $class;
Expand Down

0 comments on commit 33d0bb4

Please sign in to comment.