Skip to content

Commit

Permalink
doctrine#1130 DDC-3300 - minor refactoring (else removal, spacing)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Jan 15, 2015
1 parent eb7d43b commit 963eb65
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2742,15 +2742,18 @@ public function addDiscriminatorMapClass($name, $className)
$className = ltrim($className, '\\');
$this->discriminatorMap[$name] = $className;

if ($this->name == $className) {
if ($this->name === $className) {
$this->discriminatorValue = $name;
} else {
if ( ! class_exists($className) && ! interface_exists($className)) {
throw MappingException::invalidClassInDiscriminatorMap($className, $this->name);
}
if (is_subclass_of($className, $this->name) && ! in_array($className, $this->subClasses)) {
$this->subClasses[] = $className;
}

return;
}

if ( ! (class_exists($className) || interface_exists($className))) {
throw MappingException::invalidClassInDiscriminatorMap($className, $this->name);
}

if (is_subclass_of($className, $this->name) && ! in_array($className, $this->subClasses)) {
$this->subClasses[] = $className;
}
}

Expand Down

0 comments on commit 963eb65

Please sign in to comment.