Symfony:我如何添加一个post验证器而不覆盖现有的


Symfony : how can i add a post validator without overriding the existing ones?

我使用sfGuard插件,默认情况下注册表单有几个post验证器(用于用户名和电子邮件)。

我搜索了很多,没有找到任何方法/hack添加post验证器而不必重写它们…

因为当我这样做的时候:

   $this->validatorSchema->setPostValidator(
      new sfValidatorCallback(array('callback' => array($this, 'checkPassword')))
    );

其他所有的post验证器似乎都消失了

试试这个:

$this->mergePostValidator(
  new sfValidatorCallback(array('callback' => array($this, 'checkPassword')))
);