I'm trying to do something very simple. All I want to do is validate a field. If the field is valid I want to verify that it is (unique), ie not already in the database.
I have tried many different combinations of validators, but symfony insists on running a database query to check if it exists even if it is not valid. This may seem minor, but it's wasting resources and driving me nuts. Here is the method I have tried that I was sure would work, but I get the error saying that sfValidatorPropelUnique must be used as a post validator... even though that is where I put it. public static function email() { return new sfValidatorAnd( array( new sfValidatorAnd( array( new sfValidatorString( array( 'min_length' => sfConfig::get ('sf_validation_email_min_len'), 'max_length' => sfConfig::get ('sf_validation_email_max_len'), 'trim' => true, ), array( 'min_length' => 'Email is too short (%min_length% characters minimum)', 'max_length' => 'Email is too long (%max_length% characters maximum)', ) ), new sfValidatorEmail( array( ), array( 'invalid' => 'Your email address is invalid', ) ), ) ), new sfValidatorPropelUnique( array( 'model' => 'User', 'column' => 'email', ), array( 'invalid' => 'This email address is in use by another account', ) ) ), array( 'halt_on_error' => true, 'required' => true, ), array( 'required' => 'Email address is required', ) ); } In my form class: protected function setPostValidators() { $this->validatorSchema->setPostValidator( new sfValidatorAnd( array( asValidatorsCollection::userNameUnique(), asValidatorsCollection::emailUnique(), ) ) ); } Am I approaching this wrong? I'm thinking this should be very simple. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---