The exception message should say which field is not mapped

This commit is contained in:
Miha Vrhovnik 2012-10-28 21:30:53 +01:00 committed by Miha Vrhovnik
parent a2a60c194b
commit 6b42c8cc04

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);