* Add errors into the result object
* @error The validation error to add into the results object
* @error_generic IValidationError
* @return IValidationResult
any function addError(required error);
* Set the validation target object name
* @return IValidationResult
any function setTargetName(required string name);
* Get the name of the target object that got validated
string function getTargetName();
* Get the validation locale
string function getValidationLocale();
boolean function hasLocale();
* Set the validation locale
* @return IValidationResult
any function setLocale(required string locale);
* Determine if the results had error or not
* @fieldThe field to count on (optional)
boolean function hasErrors(string field);
* @return IValidationResult
any function clearErrors();
* Get how many errors you have
* @fieldThe field to count on (optional)
numeric function getErrorCount(string field);
* Get the Errors Array, which is an array of error messages (strings)
* @fieldThe field to use to filter the error messages on (optional)
array function getAllErrors(string field);
* Get an error object for a specific field that failed. Throws exception if the field does not exist
* @fieldThe field to return error objects on
* @return IValidationError[]
array function getFieldErrors(required string field);
* Get a collection of metadata about the validation results
struct function getResultMetadata();
* Set a collection of metadata into the results object
* @return IValidationResult
any function setResultMetadata(required struct data);
* Call back that will be executed if the validation results had errors in them.
* The consumer receives the results instance: `(results) => {}, function( results ){}`
* @consumer Block to be executed if the result of the validation had errors.
function onError( required consumer )
* Call back that will be executed if the validation results had NO errors in them.
* The consumer receives the results instance: `(results) => {}, function( results ){}`
* @consumer Block to be executed if the result of the validation had NO errors.
function onSuccess( required consumer )