views:

49

answers:

1

Got this error: Widget "password_again" does not exist.

I can't think why it has suddenly started appearing. I'm using the default generator file supplied with the sfDoctrineGuard plugin

plugins/sfDoctrineGuardPlugin/modules/sfGuardUser/config/generator.yml

generator:
class: sfDoctrineGenerator
param:
  model_class:           sfGuardUser
  theme:                 admin
  non_verbose_templates: true
  with_show:             false
  singular:              ~
  plural:                ~
  route_prefix:          sf_guard_user
  with_doctrine_route:   true

config:
  fields:
    password_again: { label: "Password (again)" }

  list:
    title: User list
    display: [=username, created_at, updated_at, last_login]

  form:
    class: sfGuardUserAdminForm
    display:
      "NONE": [username, password, password_again]
      "Permissions and groups": [is_active, is_super_admin, groups_list, permissions_list]

  edit:
    title: Editing User "%%username%%"

  new:
    title: New User

The only other reference to the field password_again is here:

plugins/sfDoctrineGuardPlugin/lib/form/doctrine/base/BasesfGuardUserAdminForm.class.php

class BasesfGuardUserAdminForm extends BasesfGuardUserForm
{
  /**
   * @see sfForm
   */
  public function setup()
  {
    parent::setup();
    unset(
      $this['last_login'],
      $this['created_at'],
      $this['updated_at'],
      $this['salt'],
      $this['algorithm']
    );

    $this->widgetSchema['groups_list']->setLabel('Groups');
    $this->widgetSchema['permissions_list']->setLabel('Permissions');

    $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password']->setOption('required', false);
    $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];

    $this->widgetSchema->moveField('password_again', 'after', 'password');

    $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));
  }
}

Which again has not been changed. So I'm not quite sure what to try next to make it work.

Any ideas?

A: 

Thanks for your comment johnwards

I've managed to fix this myself.

Basically I had made my own sfGuardUserAdminForm class to override the default.

In that class' configure method, I was using the $this->setWidgets() function rather than individual calls to $this->setWidget()

Serg