1
0
mirror of synced 2024-12-13 06:46:03 +03:00

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

This commit is contained in:
romanb 2010-02-23 14:02:31 +00:00
parent cbad4bff3a
commit 4685a9ab6a
2 changed files with 122 additions and 102 deletions

View File

@ -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;
}
}
}
}

View File

@ -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."
);
}
}