public function setup()
 {
     parent::setup();
     $this->widgetSchema->setFormFormatterName('bootstrap');
     $this->widgetSchema->setNameFormat('user_form[%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', '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', 'first_name', 'last_name', 'organisation', 'website', 'street', 'post_code', 'city', 'country', 'mobile', 'phone', 'language_id', 'groups_list'), true);
     $this->getWidget('groups_list')->setOption('expanded', true);
     $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'))))));
 }
 public function setup()
 {
     parent::setup();
     $this->widgetSchema->setFormFormatterName('bootstrap');
     $this->widgetSchema->setNameFormat('user_form[%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', 'is_active', 'groups_list'), true);
     $this->setValidator('password', new ValidatorPassword(array('required' => false, 'min_length' => 10, 'max_length' => 100)));
     $this->getValidator('password_again')->setOption('required', false);
     $this->getWidget('groups_list')->setOption('expanded', true);
     $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.')))));
 }
Example #3
0
 /**
  * @see sfForm
  */
 public function configure()
 {
     parent::setup();
     unset($this['last_login'], $this['created_at'], $this['updated_at'], $this['salt'], $this['algorithm'], $this['is_super_admin'], $this['is_active'], $this['permissions_list'], $this['procedures_list'], $this['groups_list'], $this['username']);
 }