Permalink
Browse files

fixed #1356 Cannot use getLocale() in validation manager as it confli…

…cts with CF functions, changed internally
  • Loading branch information...
1 parent af58a12 commit 26e23064c621c506b436f3e87f3cf902f1d44f02 @lmajano lmajano committed May 7, 2012
@@ -13,71 +13,71 @@ interface{
* @error.hint The validation error to add into the results object
*/
IValidationResult function addError(required IValidationError error);
-
+
/**
* Set the validation target object name
*/
IValidationResult function setTargetName(required string name);
-
+
/**
* Get the name of the target object that got validated
*/
string function getTargetName();
-
+
/**
- * Get the locale
+ * Get the validation locale
*/
- string function getLocale();
-
+ string function getValidationLocale();
+
/**
* has locale information
*/
boolean function hasLocale();
-
+
/**
* Set the validation locale
*/
IValidationResult function setLocale(required string locale);
-
-
+
+
/**
* Determine if the results had error or not
* @field.hint The field to count on (optional)
*/
boolean function hasErrors(string field);
-
+
/**
* Clear All errors
*/
IValidationResult function clearErrors();
-
-
+
+
/**
* Get how many errors you have
* @field.hint The field to count on (optional)
*/
numeric function getErrorCount(string field);
-
+
/**
* Get the Errors Array, which is an array of error messages (strings)
* @field.hint The 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
* @field.hint The field to return error objects on
*/
IValidationError[] 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
*/
IValidationResult function setResultMetadata(required struct data);
-
+
}
@@ -66,9 +66,9 @@ component accessors="true" implements="IValidationResult"{
}
/**
- * Get the locale
+ * Get the validation locale
*/
- string function getLocale(){
+ string function getValidationLocale(){
return locale;
}
@@ -107,7 +107,7 @@ component accessors="true" implements="IValidationResult"{
// Validate localization?
else if( hasLocale() ){
// get i18n message, if it exists
- var message = resourceBundle.getResource(resource="#targetName#.#error.getField()#.#error.getValidationType()#",default="",locale=getLocale());
+ var message = resourceBundle.getResource(resource="#targetName#.#error.getField()#.#error.getValidationType()#",default="",locale=getValidationLocale());
// Override with localized message
if( len(message) ){
// process global replacements
@@ -15,7 +15,7 @@ component extends="coldbox.system.testing.BaseModelTest" model="coldbox.system.v
assertFalse( model.hasLocale() );
model.setLocale( 'en_US' );
assertTrue( model.hasLocale() );
- assertEquals( 'en_US', model.getLocale() );
+ assertEquals( 'en_US', model.getValidationLocale() );
}
function testTargetName(){

0 comments on commit 26e2306

Please sign in to comment.