Commit 4685a9ab authored by romanb's avatar romanb

[2.0][DDC-355] Fixed. Patch provided by Christian Heinrich.

parent cbad4bff
......@@ -1435,11 +1435,16 @@ class ClassMetadataInfo
$this->discriminatorMap[$value] = $className;
if ($this->name == $className) {
$this->discriminatorValue = $value;
} else if (is_subclass_of($className, $this->name)) {
} else {
if ( ! class_exists($className)) {
throw MappingException::invalidClassInDiscriminatorMap($className, $this->name);
}
if (is_subclass_of($className, $this->name)) {
$this->subClasses[] = $className;
}
}
}
}
/**
* Gets the discriminator value of this class.
......
......@@ -170,4 +170,19 @@ class MappingException extends \Doctrine\ORM\ORMException
{
return new self('The annotation driver needs to have a directory path');
}
/**
* Throws an exception that indicates that a class used in a discriminator map does not exist.
* An example would be an outdated (maybe renamed) classname.
*
* @param string $className The class that could not be found
* @param string $owningClass The class that declares the discriminator map.
* @return self
*/
public static function invalidClassInDiscriminatorMap($invalidClass, $owningClass) {
return new self(
"Entity class '$className' used in the discriminator map of class '$owningClass' ".
"does not exist."
);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment