Lukas Kahwe Smith wrote:
> Fabien POTENCIER wrote:
> 
>> 3 is not very good because then I can't return false as a valid value 
>> (same goes for null or whatever other value).
> 
> Well are these validators or sanitators or both? If you are just 
> validating, you do not need to be able to return the actual value. 
> Actually I think most people will only require validators. If they need 
> sanitators, then maybe this should be a different API?

Validators validates and sanitizes the value. Sanitization is really 
about simple conversions (trim whitespaces for example). It does not 
replace input filtering.

> 
>> My preference goes to the exception but PHP exceptions are quite 
>> inflexible, the message has to be a string, so if I want to return 
>> several error messages, I can't:
> 
> Right, unless you first create the "list" of errors and place them in 
> the exception. Also you really want to use error codes here, instead of 
> strings.

What do you mean by "place them in the exception"? I want to return an 
array of strings, so the user can use them as they want (think <ul> in a 
browser).

Do you mean something like this?

   throw new sfValidatorException('Error', $anArrayOfErrorStrings);

> 
> regards,
> Lukas
> 
> > 
> 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to