-
addMessage ($name, $value)
Browse code
| $name |
The error code
|
| $value |
The error message
|
Adds a new error code with a default error message.
-
addOption ($name, $value = null)
Browse code
| $name |
The option name
|
| $value |
The default value
|
Adds a new option value with a default value.
-
addRequiredOption ($name)
Browse code
Adds a required option.
-
(string) asString ($indent)
Browse code
| $indent |
Indentation (number of spaces before each line)
|
Returns a string representation of this validator.
returns The string representation of the validator
-
(mixed) clean ($value)
Browse code
Cleans the input value.
This method is also responsible for trimming the input value and checking the required option.
returns The cleaned value
throws sfValidatorError
-
configure ($options = array(), $messages = array())
Browse code
| $options |
An array of options
|
| $messages |
An array of error messages
|
Configures the current validator.
This method allows each validator to add options and error messages during validator creation.
If some options and messages are given in the sfValidatorBase constructor they will take precedence over the options and messages you configure in this method.
-
(mixed) doClean ($value)
Browse code
Cleans the input value.
Every subclass must implements this method.
returns The cleaned value
throws sfValidatorError
-
(string) getCharset ()
Browse code
Returns the charset to use when validating strings.
returns The charset (default to UTF-8)
-
(array) getDefaultMessages ()
Browse code
Returns default messages for all possible error codes.
returns An array of default error codes and messages
-
(array) getDefaultOptions ()
Browse code
Returns default option values.
returns An array of default option values
-
(mixed) getEmptyValue ()
Browse code
Returns an empty value for this validator.
returns The empty value for this validator
-
(array) getErrorCodes ()
Browse code
Returns an array of all error codes for this validator.
returns An array of possible error codes
-
(string) getMessage ($name)
Browse code
Returns an error message given an error code.
returns The error message, or the empty string if the error code does not exist
-
(array) getMessages ()
Browse code
Returns an array of current error messages.
returns An array of messages
-
(string) getMessagesWithoutDefaults ()
Browse code
Returns all error messages with non default values.
returns A string representation of the error messages
-
(mixed) getOption ($name)
Browse code
Gets an option value.
returns The option value
-
Returns all options.
returns An array of options
-
(string) getOptionsWithoutDefaults ()
Browse code
Returns all options with non default values.
returns A string representation of the options
-
(array) getRequiredOptions ()
Browse code
Returns all required option names.
returns An array of required option names
-
(bool) hasOption ($name)
Browse code
Returns true if the option exists.
returns true if the option exists, false otherwise
-
(bool) isEmpty ($value)
Browse code
Returns true if the value is empty.
returns true if the value is empty, false otherwise
-
Sets the charset to use when validating strings.
-
setDefaultMessages ($messages)
Browse code
| $messages |
An array of default error codes and messages
|
Sets default messages for all possible error codes.
-
setDefaultOptions ($options)
Browse code
| $options |
An array of default option values
|
Sets default option values.
-
setInvalidMessage ($message)
Browse code
Sets the default invalid message
-
setMessage ($name, $value)
Browse code
| $name |
The error code
|
| $value |
The error message
|
Changes an error message given the error code.
-
| $values |
An array of error messages
|
Changes all error messages.
-
setOption ($name, $value)
Browse code
| $name |
The option name
|
| $value |
The value
|
Changes an option value.
-
| $values |
An array of options
|
Changes all options.
-
setRequiredMessage ($message)
Browse code
Sets the default required message
-
__construct ($options = array(), $messages = array())
Browse code
| $options |
An array of options
|
| $messages |
An array of error messages
|
Constructor.
Available options:
* required: true if the value is required, false otherwise (default to true)
* trim: true if the value must be trimmed, false otherwise (default to false)
* empty_value: empty value when value is not required
Available error codes:
* required * invalid