MINOR Returning ValidationResult from Member->onBeforeWrite() to ensure the ValidationException is compatible with MemberTableField (related to r103336) (from r103337)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112133 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-13 03:42:49 +00:00
parent 1379f133ea
commit eb43fb14ef

View File

@ -605,12 +605,17 @@ class Member extends DataObject {
)
);
if($existingRecord) {
throw new ValidationException(sprintf(
'Can\'t overwrite existing member #%d with identical $unique_identifier_field (%s = %s))',
throw new ValidationException(new ValidationResult(false, sprintf(
_t(
'Member.ValidationIdentifierFailed',
'Can\'t overwrite existing member #%d with identical identifier (%s = %s))',
PR_MEDIUM,
'The values in brackets show a fieldname mapped to a value, usually denoting an existing email address'
),
$existingRecord->ID,
$identifierField,
$this->$identifierField
));
)));
}
}