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
declareParameterto 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 ifvalueis in A set (array)ipAddresschecks ifvalueis a string representing an IP addressinRange(n,m)checks ifvalueis a number included in range (n,m)lt(n)checks ifvalueis less than given nle(n)checks ifvalueis less or equal to than given ngt(n)checks ifvalueis greater than given nge(n)checks ifvalueis greater than or equal to given nemail()checks ifvalueis a valid email addressurl()checks ifvalueis a valid URLalphabetic()checks ifvaluecontains only lettersalphanumeric()checks ifvaluecontains only letters or numbersregexp(e)checks ifvaluematches regular expression enotEmpty()checks ifvalueis 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