如何创建需要访问其他字段值的Symfony验证器?(How do I create a Symfony validator that needs to access other fields values?)
我想实现一个验证注册表单密码的Symfony验证器,这意味着我需要一个“密码确认”字段。 如何制作一个以某种方式将这些字段联系在一起的验证器? 我需要检查密码和密码是否确认值匹配。
在Symfony中如何正确实现这些内容?
I want to implement a Symfony validator that validates passwords for a registration form, which means I want a 'Password confirm' field. How do I make a validator that somehow ties these fields together? I need to check if the password and password confirm values match.
How are stuff like these implemented properly in Symfony?
最满意答案
您可以使用postValidator。 查看文档,有一个密码确认验证的示例。
You can use a postValidator . Check the documentation, there is an example with the password confirm validation.
更多推荐
发布评论