Skip to content

Instantly share code, notes, and snippets.

@dmclark
Created February 24, 2011 17:59
Show Gist options
  • Save dmclark/842566 to your computer and use it in GitHub Desktop.
Save dmclark/842566 to your computer and use it in GitHub Desktop.
class sfGuardUserForm extends PluginsfGuardUserForm
{
public function configure()
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'first_name' => new sfWidgetFormInputText(),
'last_name' => new sfWidgetFormInputText(),
'email_address' => new sfWidgetFormInputText(),
'username' => new sfWidgetFormInputText(),
'center_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Center'), 'add_empty' => false)),
'role' => new sfWidgetFormInputText(),
// 'algorithm' => new sfWidgetFormInputText(),
// 'salt' => new sfWidgetFormInputText(),
'password' => new sfWidgetFormInputText(),
// 'is_active' => new sfWidgetFormInputCheckbox(),
// 'is_super_admin' => new sfWidgetFormInputCheckbox(),
// 'last_login' => new sfWidgetFormDateTime(),
// 'created_at' => new sfWidgetFormDateTime(),
// 'updated_at' => new sfWidgetFormDateTime(),
'groups_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup')),
'permissions_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission')),
));
$this->setValidators(array(
'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
'first_name' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
'last_name' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
'email_address' => new sfValidatorString(array('max_length' => 255)),
'username' => new sfValidatorString(array('max_length' => 128)),
'algorithm' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
'salt' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
'password' => new sfValidatorString(array('max_length' => 128, 'required' => false)),
'is_active' => new sfValidatorBoolean(array('required' => false)),
'is_super_admin' => new sfValidatorBoolean(array('required' => false)),
'last_login' => new sfValidatorDateTime(array('required' => false)),
'created_at' => new sfValidatorDateTime(),
'updated_at' => new sfValidatorDateTime(),
'groups_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup', 'required' => false)),
'permissions_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission', 'required' => false)),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment