Self validating statements

This is the equivalent of setting the cascade mode on every rule within the validator.

self validating statements-25self validating statements-14self validating statements-18self validating statements-46

It is also possible to use your own custom arguments in the validation message.

This allows you to split rules across multiple classes and compose them together (in a similar way to how other languages support traits).

For example, imagine you have 2 validators that validate different aspects of a Note that custom error messages can contain placeholders for special values such as ‘’ - which will be replaced in this example with the name of the property being validated.

This means the above error message could be re-written as: …and the value ‘Surname’ will be inserted.

As specified in the example above, the message can contain placeholders for special values such as ‘’ - which will be replaced with a specified value.

Leave a Reply