Domain Object
Within any domain object you can define a public variable called this.constraints
that is a assigned an implicit structure of validation rules for any fields or properties in your object.
Declaration
models/User.cfc
We can then create the validation rules for the properties it will apply to it:
config/User.cfc
That easy! You can just declare these validation rules and ColdBox will validate your properties according to the rules. In this case you can see that a password must be between 6 and 10 characters long, and it cannot be blank.
By default all properties are of type string and not required
Usage
You can then use them implicitly when calling our validation methods:
Last updated