官方英文资料(未自动翻译);本文按官方对应版本整理,保留说明和代码。站内处理包括移除站点导航、还原代码格式及调整链接。
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.
Read the Validation article to learn how to apply these constraints and how to create a custom constraint if none of them fits your needs.
Supported Constraints
The following constraints are natively available in Symfony:
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
Comparison Constraints
Number Constraints
Doctrine Constraints
Other Constraints
This work, including the code samples, is licensed under a
Creative Commons BY-SA 3.0 license.
TOC
Version
来源与许可
Symfony documentation contributors。本资料采用 CC BY-SA 3.0;本页为官方资料的站内整理版本,并非框架官方网站。 许可说明