Feature #3093
Implement annotation based validation rules for models
Status:
Resolved
Priority:
Must have
Assignee:
Category:
Validation
Target version:
Start date:
2009-04-15
Due date:
% Done:
100%
PHP Version:
Has patch:
Complexity:
Description
Make these @validate annotations work in a model:
/** * The blog's name. Also acts as the identifier. * * @var string * @validate Alphanumeric, StringLength(minimum = 3, maximum = 50) * @identity */ protected $name = ''; /** * A short description of the blog * * @var string * @validate Text, StringLength(maximum = 150) */ protected $description = '';
Associated revisions
This commit is all about validation. Although the new features basically work, a few smaller features and tweak are missing before the whole concept works as intended. Documentation will follow (hopefully soon).
- FLOW3: (Validation) Implemented annotation based validation for models. That means you now can define validation rules by adding @validate annotations to class properties and these rules will be enforced when arguments of this type are passed as controller arguments. Resolves #3093 but some fine tuning and small additional features are missing.
- FLOW3: (Validation) Note that #3130 is not solved yet in this commit.
- FLOW3: (MVC) Implemented a MVC Controller Arguments Validator which is able to validate a whole Arguments object. This is used during the mapAndValidate process in the controller. Addresses #3093.
- FLOW3: (Property) The property mapper now accepts arrays as source and / or target.
- FLOW3: (Property) mapAndValidate() will now truly validate the result of the mapping. If the result does not validate, the target remains unchanged.
- FLOW3: (Validation) Removed the Filter Chain for now - it will surely come back but didn't work like it was currently implemented.
- FLOW3: (Validation) Improved the AbstractValidator and added a new AbstractObjectValidator
- FLOW3: (Validation) Adapted all validators to the new Validator interface and AbstractValidator
- FLOW3: (Validation) Implemented a new Generic Object validator which can validate properties of any object
- FLOW3: (Validation) Simplified the chaining of validators and during that process removed the ObjectValidatorChainValidator
- FLOW3: Added and adapted many tests
History
#1
Updated by Robert Lemke over 10 years ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset r2185.