Two points:

- you're trying to overwrite the existing validator of the email field

- as the error message says: sfValidatorPropelUnique may only be used
as a post validator. Here's an example:

$this->validatorSchema->setPostValidator(
  new sfValidatorPropelUnique(array(
    "throw_global_error"  =>  false,
    "model"   =>              "sfGuardUser",
    "column"  =>              "username",
    "field"   =>              array("email"),
  ), array(
    "invalid" =>  "Már használt e-mail cím!",
  ))
);

-- mrl

2011/5/22 Ethan <ruanx...@gmail.com>:
> hello,everyone,
> i created a register form:
> class RegForm extends sfForm{
> public function configure(){
>                $this->setWidgets(array(
>                       ...
>                        'email'=> new
> sfWidgetFormInputText(array('label'=>'email address:','default'=>'@')),
>                      ....
>                 ));
>                 $this->setValidators(array(
>                        ...
>                        'email'=>new
> sfValidatorEmail(array(),array('required'=>'Email cannot
> empty','invalid'=>'Email invalid')),
>                        ...
>                ));
>               $this->setValidator('email',new
> sfValidatorPropelUnique(array('model'=>'Userinfo','column'=>array('Uemail')),array('invalid'=>'email
> EXISTS.')));
>         }
> }
> and i want to check whether email address existed in db before user
> register. according to document, it seems need to
> use sfValidatorPropelUnique ,but when i try to add the red code, i received
> an error
>
> You must pass an array parameter to the clean() method (this validator can
> only be used as a post validator).
>
> can someone told me the right way to do this process?
>
>
>
> ------------------------------------------
>          少许诺多兑现
> ------------------------------------------
>
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to