Permalink
Browse files

DDC-1456 - Disallow setting id generators on composite identifiers.

  • Loading branch information...
1 parent 072094f commit 9cd8f85a8cef8d97c3d9dfe03d45b580998e0032 @beberlei beberlei committed Dec 17, 2011
@@ -371,6 +371,10 @@ protected function validateRuntimeMetadata($class, $parent)
// second condition is necessary for mapped superclasses in the middle of an inheritance hierachy
throw MappingException::noInheritanceOnMappedSuperClass($class->name);
}
+
+ if ($class->usesIdGenerator() && $class->isIdentifierComposite) {
+ throw MappingException::compositeKeyAssignedIdGeneratorRequired($class->name);
+ }
}
/**
@@ -314,4 +314,9 @@ public static function invalidFetchMode($className, $annotation)
{
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
}
+
+ public static function compositeKeyAssignedIdGeneratorRequired($className)
+ {
+ return new self("Entity '". $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
+ }
}
@@ -141,18 +141,16 @@ class InvalidEntity2
{
/**
* @Id @Column
- * @GeneratedValue(strategy="AUTO")
*/
protected $key3;
/**
* @Id @Column
- * @GeneratedValue(strategy="AUTO")
*/
protected $key4;
/**
* @ManyToOne(targetEntity="InvalidEntity1")
*/
protected $assoc;
-}
+}

0 comments on commit 9cd8f85

Please sign in to comment.