[2.0][DDC-355] Fixed. Patch provided by Christian Heinrich.
This commit is contained in:
parent
cbad4bff3a
commit
4685a9ab6a
@ -1435,11 +1435,16 @@ class ClassMetadataInfo
|
|||||||
$this->discriminatorMap[$value] = $className;
|
$this->discriminatorMap[$value] = $className;
|
||||||
if ($this->name == $className) {
|
if ($this->name == $className) {
|
||||||
$this->discriminatorValue = $value;
|
$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;
|
$this->subClasses[] = $className;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the discriminator value of this class.
|
* 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');
|
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