0

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?

Serg
  • 135
  • 1
  • 9
  • 1
    Is sfGuard and all its classes it provides, the user ones anyway, untouched and in the state that you installed them in? Also could you paste up (pastebin if you want) the full stack trace. – johnwards Jul 05 '10 at 14:10

2 Answers2

1

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
  • 135
  • 1
  • 9
0

I found this error once I wrongly I generate the sfGuardUser module for the admin. It is wrong because I should use the module that comes with the plugin instead.

tirenweb
  • 30,963
  • 73
  • 183
  • 303