public function setup()
 {
     parent::setup();
     $this->widgetSchema->setFormFormatterName('bootstrap');
     $this->widgetSchema->setNameFormat('password_form[%s]');
     foreach (array('password', 'password_again') as $field) {
         $this->getValidator($field)->setOption('required', true);
     }
     $this->useFields(array('password', 'password_again'), true);
     $this->setValidator('password', new ValidatorPassword(array('required' => true, 'min_length' => 10, 'max_length' => 100)));
     $this->getValidator('password_again')->setOption('required', false);
     $this->getWidgetSchema()->setHelp('password', 'Your password must be at least 10 characters long, and include at least one number and one capital letter.');
     $this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));
 }
 public function setup()
 {
     parent::setup();
     $this->widgetSchema->setFormFormatterName('bootstrap');
     $this->widgetSchema->setNameFormat('profile[%s]');
     $this->setWidget('country', new sfWidgetFormI18nChoiceCountry());
     $this->setValidator('country', new sfValidatorI18nChoiceCountry());
     $this->setValidator('email_address', new ValidatorEmail(array('max_length' => 80)));
     foreach (array('email_address', 'password', 'password_again', 'first_name', 'last_name', 'organisation', 'website', 'street', 'post_code', 'city', 'country', 'mobile', 'phone', 'language_id') as $field) {
         $this->getValidator($field)->setOption('required', true);
     }
     $this->useFields(array('email_address', 'password', 'password_again', 'first_name', 'last_name', 'organisation', 'website', 'street', 'post_code', 'city', 'country', 'mobile', 'phone', 'language_id'), true);
     $this->setValidator('password', new ValidatorPassword(array('required' => false, 'min_length' => 10, 'max_length' => 100)));
     $this->getValidator('password_again')->setOption('required', false);
     $this->getWidgetSchema()->setHelp('password', 'Your password must be at least 10 characters long, and include at least one number and one capital letter.');
     $this->getWidgetSchema()->setHelp('street', 'In accordance with our terms of service and legal obligations, you must provide your, or your organisations\' legal address.');
     $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorDoctrineUnique(array('model' => 'sfGuardUser', 'column' => array('email_address')), array('invalid' => 'An user account with this email exists already.')), new sfValidatorDoctrineUnique(array('model' => 'sfGuardUser', 'column' => array('username'))), new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')))));
 }