Feature #12
Validator API
Status: | CLOSED | Start date: | 04/07/2011 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 100% | |
Category: | nethserver-nethgui | |||
Target version: | Epsilon | |||
Resolution: | NEEDINFO: |
Description
Define a way to assign a validator to a parameter in a Module.
A validator object- Has a fluent interface with AND semantics
- Allows composition of other validators through OR
Checking in a module if myParameter1
is an empty string OR a member of {'enabled', 'disabled'}
set.
$this->declareParameter( 'myParameter1', $this->getValidator()->or( $this->getValidator()->empty(), $this->getValidator()->memberOf('enabled', 'disabled') ) ... );
Subtasks
Related issues
Associated revisions
Refs #12. Implemented Validator API.
As proposed in #12, added NethGui_Core_Validator
class and generic validator interface: NethGui_Core_ValidatorInterface
.
- Added also a unit test (incomplete).
- Updated standard module
declareParameter
to deal with Validators. - Added
getValidator()
method to Standard module.
System: Moved constants. Moved createValidator() in NethPlatform class. Refs #12 - Validator API
History
#1 Updated by Davide Principi over 10 years ago
- Assignee set to Davide Principi
- Target version set to Epsilon
#2 Updated by Davide Principi over 10 years ago
- Start date changed from 03/25/2011 to 03/30/2011
- Estimated time set to 12.00
#3 Updated by Davide Principi over 10 years ago
- Status changed from NEW to ON_DEV
- Start date changed from 03/30/2011 to 04/01/2011
#4 Updated by Davide Principi over 10 years ago
Validator cases:
memberOf(A)
checks ifvalue
is in A set (array)ipAddress
checks ifvalue
is a string representing an IP addressinRange(n,m)
checks ifvalue
is a number included in range (n,m)lt(n)
checks ifvalue
is less than given nle(n)
checks ifvalue
is less or equal to than given ngt(n)
checks ifvalue
is greater than given nge(n)
checks ifvalue
is greater than or equal to given nemail()
checks ifvalue
is a valid email addressurl()
checks ifvalue
is a valid URLalphabetic()
checks ifvalue
contains only lettersalphanumeric()
checks ifvalue
contains only letters or numbersregexp(e)
checks ifvalue
matches regular expression enotEmpty()
checks ifvalue
is not an empty string,0
, or NULL
...
#5 Updated by Davide Principi over 10 years ago
- % Done changed from 0 to 20
#6 Updated by Davide Principi over 10 years ago
- Estimated time changed from 12.00 to 4.00
#7 Updated by Davide Principi over 10 years ago
- Status changed from ON_DEV to CLOSED
- % Done changed from 20 to 100