symfony 验证器错误名称常量

标签 symfony validation

我想知道每个验证器中的这些代码有什么用途,即https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/NotBlank.php#L24

class NotBlank extends Constraint
{
    const IS_BLANK_ERROR = 'c1051bb4-d103-4f74-8988-acbcafc7fdc3';

我在 http://symfony.com/doc/master/validation/custom_constraint.html 中都找不到任何有关它的文档。 :使用什么算法来生成它们?

最佳答案

这似乎是一个UUID。来自 Wikipedia :

A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. The term globally unique identifier (GUID) is also used.

When generated according to the standard methods, UUIDs are for practical purposes unique, without depending for their uniqueness on a central registration authority or coordination between the parties generating them, unlike most other numbering schemes. While the probability that a UUID will be duplicated is not zero, it is close enough to zero to be negligible.

在 PHP 中,您可以使用 UUID 生成它PECL 包或使用类似 this one 的库.

关于symfony 验证器错误名称常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51356751/

相关文章:

php - 运行 Symfony2 命令测试时如何设置命令行标志?

php - 使用来自自定义服务的编译器传递加载 Symfony 的参数

ruby-on-rails - 如何验证开始日期和结束日期?

validation - 使用 express-form 验证错误后如何重新填充表单字段?

python - Python中10倍交叉验证代码出错

validation - 我无法根据 grails 'inList' 中的 double 列表验证 double

php - 从 PHP Controller 运行 Python 脚本

symfony - 从 Controller 中的 URL 获取协议(protocol)

symfony - 通过 Symfony2/Doctrine 中的相关实体访问存储库

c++ - While循环中的C++ cin输入验证