Jak w formularzu rejestracyjnym ustawiałem to pole na domyślnie 0 to i tak po dodaniu użytkownika było 1:
<?php class RejestracjaForm extends sfGuardUserForm { public function configure() { $this['id'], $this['is_active'], $this['is_super_admin'], $this['updated_at'], $this['groups_list'], $this['permissions_list'], $this['last_login'], $this['created_at'], $this['salt'], $this['algorithm'] ); //$this->widgetSchema['is_active'] = new sfWidgetFormInput(); $this->widgetSchema['password'] = new sfWidgetFormInputPassword(); $this->widgetSchema['password_confirmation'] = new sfWidgetFormInputPassword(); $this->widgetSchema['imie'] = new sfWidgetFormInput(); $this->widgetSchema['nazwisko'] = new sfWidgetFormInput(); $this->widgetSchema['email'] = new sfWidgetFormInput(); //$this->setDefaults(array('is_active' => 0)); 'username' => 'Login', 'password' => 'Hasło', 'password_confirmation' => 'Powtórz hasło', )); 'username' => new sfValidatorString(array('max_length' => 50, 'min_length' => 5, 'required' => true), array('required' => 'Nie wpisano loginu.', 'max_length' => 'Zbyt długi login.', 'min_length' => 'Zbyt krótki login.')), 'password' => new sfValidatorString(array('max_length' => 50, 'min_length' => 5, 'required' => true), array('required' => 'Nie wpisano hasła.', 'max_length' => 'Zbyt długe hasło.', 'min_length' => 'Zbyt krótkie hasło.')), 'password_confirmation' => new sfValidatorString(array('max_length' => 50, 'min_length' => 5, 'required' => true), array('required' => 'Nie wpisano hasła.', 'max_length' => 'Zbyt długe hasło.', 'min_length' => 'Zbyt krótkie hasło.')), array('required' => 'Imie jest wymagane.', 'min_length' => 'Imie jest za krótkie.', 'max_length' => 'Imie jest za długie.')), 'max_length' => 'Nazwisko jest za długie.')), )); } } ?>
Jak po dodaniu uzytkownika probowalem ustawic za pomoca setIsActive na 0 to też nic z tego:
<?php class rejestracjaActions extends sfActions { public function executeIndex(sfWebRequest $request) { $this->form = new RejestracjaForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('sf_guard_user')); if ($this->form->isValid()) { $conn = Doctrine_Manager::connection(); //rozpoczecie transakcji bo dodaje do dwoch tabel - uzytkownika do sf_guard_user, a jego profil do sf_guard_user_profile: $conn->beginTransaction(); try { $uzytkownik = $this->form->save(); //$uzytkownik->setIsActive(0); $profil = new SfGuardUserProfile(); $profil -> setUserId($uzytkownik->getId()); $profil -> setImie($this->form->getValue('imie')); $profil -> setNazwisko($this->form->getValue('nazwisko')); $profil -> setEmail($this->form->getValue('email')); $profil -> save(); $conn->commit(); } catch (Exception $e) { $conn->rollBack(); throw $e; } } } } } ?>