1
0
mirror of synced 2025-01-18 22:41:43 +03:00

AssignedGenerator can always tell what field is missing an id

This commit is contained in:
Alexander 2011-10-15 19:23:36 +02:00
parent d24f288149
commit fdb9fb1c2b
2 changed files with 2 additions and 10 deletions

View File

@ -78,7 +78,7 @@ class AssignedGenerator extends AbstractIdGenerator
$identifier[$idField] = $value; $identifier[$idField] = $value;
} }
} else { } else {
throw ORMException::entityMissingAssignedId($entity); throw ORMException::entityMissingAssignedIdForField($entity, $idField);
} }
} }

View File

@ -46,14 +46,6 @@ class ORMException extends Exception
); );
} }
public static function entityMissingAssignedId($entity)
{
return new self("Entity of type " . get_class($entity) . " is missing an assigned ID. " .
"The identifier generation strategy for this entity requires the ID field to be populated before ".
"EntityManager#persist() is called. If you want automatically generated identifiers instead " .
"you need to adjust the metadata mapping accordingly."
);
}
public static function entityMissingAssignedIdForField($entity, $field) public static function entityMissingAssignedIdForField($entity, $field)
{ {
return new self("Entity of type " . get_class($entity) . " is missing an assigned ID for field '" . $field . "'. " . return new self("Entity of type " . get_class($entity) . " is missing an assigned ID for field '" . $field . "'. " .