Commit 4685a9ab authored by romanb's avatar romanb

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

parent cbad4bff
...@@ -33,62 +33,62 @@ class MappingException extends \Doctrine\ORM\ORMException ...@@ -33,62 +33,62 @@ class MappingException extends \Doctrine\ORM\ORMException
return new self("No identifier/primary key specified for Entity '$entityName'." return new self("No identifier/primary key specified for Entity '$entityName'."
. " Every Entity must have an identifier/primary key."); . " Every Entity must have an identifier/primary key.");
} }
public static function invalidInheritanceType($type) public static function invalidInheritanceType($type)
{ {
return new self("The inheritance type '$type' does not exist."); return new self("The inheritance type '$type' does not exist.");
} }
public static function generatorNotAllowedWithCompositeId() public static function generatorNotAllowedWithCompositeId()
{ {
return new self("Id generators can't be used with a composite id."); return new self("Id generators can't be used with a composite id.");
} }
public static function missingFieldName() public static function missingFieldName()
{ {
return new self("The association mapping misses the 'fieldName' attribute."); return new self("The association mapping misses the 'fieldName' attribute.");
} }
public static function missingTargetEntity($fieldName) public static function missingTargetEntity($fieldName)
{ {
return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute."); return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute.");
} }
public static function missingSourceEntity($fieldName) public static function missingSourceEntity($fieldName)
{ {
return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute."); return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute.");
} }
public static function mappingFileNotFound($fileName) public static function mappingFileNotFound($fileName)
{ {
return new self("No mapping file found named '$fileName'."); return new self("No mapping file found named '$fileName'.");
} }
public static function mappingNotFound($fieldName) public static function mappingNotFound($fieldName)
{ {
return new self("No mapping found for field '$fieldName'."); return new self("No mapping found for field '$fieldName'.");
} }
public static function oneToManyRequiresMappedBy($fieldName) public static function oneToManyRequiresMappedBy($fieldName)
{ {
return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute."); return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute.");
} }
public static function joinTableRequired($fieldName) public static function joinTableRequired($fieldName)
{ {
return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute."); return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute.");
} }
/** /**
* Called if a required option was not found but is required * Called if a required option was not found but is required
* *
* @param string $field which field cannot be processed? * @param string $field which field cannot be processed?
* @param string $expectedOption which option is required * @param string $expectedOption which option is required
* @param string $hint Can optionally be used to supply a tip for common mistakes, * @param string $hint Can optionally be used to supply a tip for common mistakes,
* e.g. "Did you think of the plural s?" * e.g. "Did you think of the plural s?"
* @return MappingException * @return MappingException
*/ */
static function missingRequiredOption($field, $expectedOption, $hint = '') static function missingRequiredOption($field, $expectedOption, $hint = '')
{ {
$message = "The mapping of field '{$field}' is invalid: The option '{$expectedOption}' is required."; $message = "The mapping of field '{$field}' is invalid: The option '{$expectedOption}' is required.";
...@@ -98,7 +98,7 @@ class MappingException extends \Doctrine\ORM\ORMException ...@@ -98,7 +98,7 @@ class MappingException extends \Doctrine\ORM\ORMException
return new self($message); return new self($message);
} }
/** /**
* Generic exception for invalid mappings. * Generic exception for invalid mappings.
* *
...@@ -108,12 +108,12 @@ class MappingException extends \Doctrine\ORM\ORMException ...@@ -108,12 +108,12 @@ class MappingException extends \Doctrine\ORM\ORMException
{ {
return new self("The mapping of field '$fieldName' is invalid."); return new self("The mapping of field '$fieldName' is invalid.");
} }
/** /**
* Exception for reflection exceptions - adds the entity name, * Exception for reflection exceptions - adds the entity name,
* because there might be long classnames that will be shortened * because there might be long classnames that will be shortened
* within the stacktrace * within the stacktrace
* *
* @param string $entity The entity's name * @param string $entity The entity's name
* @param \ReflectionException $previousException * @param \ReflectionException $previousException
*/ */
...@@ -121,7 +121,7 @@ class MappingException extends \Doctrine\ORM\ORMException ...@@ -121,7 +121,7 @@ class MappingException extends \Doctrine\ORM\ORMException
{ {
return new self('An error occurred in ' . $entity, 0, $previousException); return new self('An error occurred in ' . $entity, 0, $previousException);
} }
public static function joinColumnMustPointToMappedField($className, $joinColumn) public static function joinColumnMustPointToMappedField($className, $joinColumn)
{ {
return new self('The column ' . $joinColumn . ' must be mapped to a field in class ' return new self('The column ' . $joinColumn . ' must be mapped to a field in class '
...@@ -165,9 +165,24 @@ class MappingException extends \Doctrine\ORM\ORMException ...@@ -165,9 +165,24 @@ class MappingException extends \Doctrine\ORM\ORMException
.'is not supported by Doctrine.' .'is not supported by Doctrine.'
); );
} }
public static function annotationDriverRequiresConfiguredDirectoryPath() public static function annotationDriverRequiresConfiguredDirectoryPath()
{ {
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."
);
}
} }
\ 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