DDC-873 - throw exception if trying to add @version to @id
This commit is contained in:
parent
4ea3277c28
commit
ae9080aa98
@ -670,6 +670,10 @@ class ClassMetadataInfo
|
||||
|
||||
// Complete id mapping
|
||||
if (isset($mapping['id']) && $mapping['id'] === true) {
|
||||
if ($this->versionField == $mapping['fieldName']) {
|
||||
throw MappingException::cannotVersionIdField($this->name, $mapping['fieldName']);
|
||||
}
|
||||
|
||||
if ( ! in_array($mapping['fieldName'], $this->identifier)) {
|
||||
$this->identifier[] = $mapping['fieldName'];
|
||||
}
|
||||
|
@ -212,6 +212,11 @@ class MappingException extends \Doctrine\ORM\ORMException
|
||||
return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!");
|
||||
}
|
||||
|
||||
public static function cannotVersionIdField($className, $fieldName)
|
||||
{
|
||||
return new self("Setting Id field '$fieldName' as versionale in entity class '$className' is not supported.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $columnName
|
||||
|
Loading…
Reference in New Issue
Block a user