Symfony中的验证器无效

    public function configure()
        {
            parent::configure();

            $email = $this->getWidget('email');
            $class = get_class($email);
            $this->setWidget('email2', 
                    new $class( array(), array('maxlength' =>

$ email-> getAttribute('maxlength')))); $ this-> widgetSchema-> moveField('email2',sfWidgetFormSchema :: AFTER,'email');

$这 - > widgetSchema-> setNameFormat( 'sfApplyApply [%s]的'); $这个 - > widgetSchema-> setFormFormatterName(名单');

            $this->setValidator('email', new sfValidatorAnd(

数组(new(sfValidatorEmail)(array('required'=> true,'trim'=> true)),new sfValidatorString(array('required'=> true,'max_length'=> 80)),new sfValidatorDoctrineUnique(array(' ''''''''''''','''''',''''',''''','''''''我的密码。”') ) )));

            $this->setValidator('email2', new sfValidatorEmail( 
                    array( 'required' => true, 'trim' => true )));

            $schema = $this->validatorSchema;

            // Hey Fabien, adding more postvalidators is kinda

详细! $ postValidator = $ schema-> getPostValidator();

            $postValidators = array( 
                new sfValidatorSchemaCompare( 'password',

sfValidatorSchemaCompare ::'EQUAL','email2',array(),' ,array('invalid'=>'电子邮件地址不匹配')));

            if( $postValidator )
            {
                $postValidators[] = $postValidator;
            }

            $this->validatorSchema->setPostValidator( new

sfValidatorAnd($ postValidators)); }}

为什么如果在数据库中的另一个用户使用相同的电子邮件,那么我有两个错误 - 第一个与这个信息,第二个 - 电子邮件不匹配。

我该如何解决它?

链接地址: http://www.djcxy.com/p/69747.html

上一篇: invalid validators in Symfony

下一篇: Form fields stability php