Minimal example of using
@Validator with (custom) validator:
To pass extra arguments for validator, use named parameters.
Example uf using built-in validator with parameter:
@Validator(StringValidator, min = 10)
There are also extra annotations for common validators. This is to provide easier and possibly more obvious validation instructions.
Example of using built-in predefined validator annotations:
/** * @RequiredValidator * @UniqueValidator */ public $host = '';
Above code will ensure that attribute is not empty and that it is unique in collection.