You are browsing the Symfony 4.0 documentation, which changes significantly from Symfony 3.x. If your app doesn't use Symfony 4.0 yet, browse the Symfony 3.4 documentation.
Validation Constraints Reference
Validation Constraints Reference¶
The Validator is designed to validate objects against constraints. In real life, a constraint could be: "The cake must not be burned". In Symfony, constraints are similar: They are assertions that a condition is true.
The following constraints are natively available in Symfony:
These are the basic constraints: use them to assert very basic things about the value of properties or the return value of methods on your object.
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.