1
0
mirror of synced 2024-12-14 07:06:04 +03:00

DDC-873 - throw exception if trying to add @version to @id

This commit is contained in:
Benjamin Eberlei 2010-11-11 21:21:17 +01:00
parent 4ea3277c28
commit ae9080aa98
2 changed files with 9 additions and 0 deletions

View File

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

View File

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