[2.0][DDC-355] Fixed. Patch provided by Christian Heinrich.
This commit is contained in:
parent
cbad4bff3a
commit
4685a9ab6a
@ -1435,8 +1435,13 @@ class ClassMetadataInfo
|
||||
$this->discriminatorMap[$value] = $className;
|
||||
if ($this->name == $className) {
|
||||
$this->discriminatorValue = $value;
|
||||
} else if (is_subclass_of($className, $this->name)) {
|
||||
$this->subClasses[] = $className;
|
||||
} else {
|
||||
if ( ! class_exists($className)) {
|
||||
throw MappingException::invalidClassInDiscriminatorMap($className, $this->name);
|
||||
}
|
||||
if (is_subclass_of($className, $this->name)) {
|
||||
$this->subClasses[] = $className;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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."
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user