merged branch mvrhov/patch-2 (PR #5857)

This PR was merged into the 2.0 branch.

Commits
-------

6b42c8c The exception message should say which field is not mapped

Discussion
----------

The exception message should tell which field is not mapped
This commit is contained in:
Fabien Potencier 2012-10-29 09:25:35 +01:00
commit a09319df75

View File

@ -63,7 +63,7 @@ class UniqueEntityValidator extends ConstraintValidator
$criteria = array();
foreach ($fields as $fieldName) {
if (!isset($class->reflFields[$fieldName])) {
throw new ConstraintDefinitionException('Only field names mapped by Doctrine can be validated for uniqueness.');
throw new ConstraintDefinitionException(sprintf("The field '%s' is not mapped by Doctrine, so it cannot be validated for uniqueness.", $fieldName));
}
$criteria[$fieldName] = $class->reflFields[$fieldName]->getValue($entity);