Validation Constraints ReferenceEdit this page
Warning: You are browsing the documentation for Symfony 2.1, which is no longer maintained.
Read the updated version of this page for Symfony 6.1 (the current stable version).
The Validator is designed to validate objects against constraints.
In real life, a constraint could be: "The cake must not be burned". In
Symfony2, constraints are similar: They are assertions that a condition is
The following constraints are natively available in Symfony2:
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.