SHARE
TWEET

Untitled

a guest Sep 14th, 2017 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class registerForm extends sfGuardUserForm
  2. {
  3.     public function configure()
  4.     {
  5.       parent::configure();
  6.        
  7.       $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
  8.  
  9.       $this->widgetSchema->setLabels(array(
  10.         'username'        =>  'Email',
  11.       ));
  12.        
  13.       #EMBEDDEDS
  14.       $user_form = new UserForm($this->object->Profile);
  15.       //echo "voici l'id du userForm : ".$user_form->getObject()->getId();die();
  16.       $this->embedForm('user', $user_form);
  17.    
  18.       // unset($address_form['civility']);
  19.       // unset($address_form['firstname']);
  20.       // unset($address_form['lastname']);
  21.        
  22.       # VALIDATORS
  23.    
  24.       $this->validatorSchema['password'] = new sfValidatorString(array('min_length' => 4), array('required' => 'Field required'));
  25.       $this->validatorSchema['username'] = new sfValidatorEmail(array(), array('invalid' => 'This email address is invalid'));
  26.    
  27.    
  28.          
  29.       $this->validatorSchema->getPostValidator()->setMessages(array(
  30.         'invalid' => 'This field is invalid',
  31.         'Required' => 'There field is required'
  32.       ));
  33.      
  34.       if($this->isNew()){
  35.         $this->validatorSchema['password']->setOption('required', true);
  36.       }
  37.    
  38.       //$this->useFields(array('username', 'password','id','first_name','user'));
  39.    
  40.    
  41.       # EXTRA FIELDS
  42.       unset($this['is_active'], $this['is_super_admin'], $this['last_login'],
  43.          //$this['created_at'], $this['updated_at'], $this['groups_list'], $this['permissions_list'], $this['guard_id'], $this['password_again'], $this['salt'], $this['algorithm']);
  44.          $this['created_at'], $this['updated_at'], $this['groups_list'], $this['permissions_list'], $this['password_again'], $this['salt'], $this['algorithm'], $this["description"]);
  45.     }
RAW Paste Data
Top