Skip to content

Instantly share code, notes, and snippets.

@donut
Created February 17, 2009 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donut/65868 to your computer and use it in GitHub Desktop.
Save donut/65868 to your computer and use it in GitHub Desktop.
<?php
/**
* sfGuardUser form.
*
* @package form
* @subpackage sfGuardUser
* @version SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
*/
class sfGuardUserForm extends PluginsfGuardUserForm
{
public function configure () {
unset($this['algorithm'], $this['is_active'], $this['is_super_admin'], $this['salt'],
$this['last_login'], $this['created_at'], $this['updated_at']);
$this->embedForm('sfGuardUserProfile', new sfGuardUserProfileForm($this->getObject()->profile()));
$this->widgetSchema['username']->setAttribute('class', 'text');
$this->setWidget('password', new sfWidgetFormInputPassword(array(), array('class' => 'text')));
$this->setWidget('confirm_password', new sfWidgetFormInputPassword(array(), array('class' => 'text')));
$this->setValidator('password', new sfValidatorString(array('max_length' => 128)));
if (!$this->isNew())
$this->validatorSchema['password']->setOption('required', false);
$this->validatorSchema['confirm_password'] = clone $this->validatorSchema['password'];
$this->widgetSchema->moveField('confirm_password', 'after', 'password');
$this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'confirm_password',
array(), array('invalid' => 'Passwords do not match.')));
}
// protected function doSave ($con = null) {
// parent::doSave($con);
//
// echo "PING!";
//set user for profile object
// $user = $this->getObject();
// $embedded_forms = $this->getEmbeddedForms();
// $profile = $embedded_forms['profile']->getObject();
// if ($profile->getUserId() != $user->getId()) {
// $profile->setUserId($user->getId());
// $profile->save(); }
// }
// public function updateObject ($values = null)
// {
// $object = parent::updateObject($values);
// $this->getObject()->profile()->setUserId($this->getObject()->getId());
// return $object;
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment