Validation Constraints Reference

Caution: You are browsing the documentation for Symfony version 2.0 which is not maintained anymore . If some of your projects are still using this version, consider upgrading to Symfony 2.5.

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 Symfony2, constraints are similar: They are assertions that a condition is true.

Supported Constraints

The following constraints are natively available in Symfony2:

Basic Constraints

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.

String Constraints

Number Constraints

Date Constraints

File Constraints

Other Constraints

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License .