0

次のエラーが発生しました: ウィジェット "password_again" が存在しません。

なぜそれが突然現れ始めたのか、私には考えられません。sfDoctrineGuard プラグインで提供されるデフォルトのジェネレーター ファイルを使用しています

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

フィールド password_again への唯一の他の参照はここにあります:

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.')));
  }
}

これも変更されていません。ですから、それを機能させるために次に何を試すべきかはよくわかりません。

何か案は?

4

2 に答える 2

1

コメントありがとうございます

私はこれを自分で修正することができました。

基本的に、デフォルトをオーバーライドするために独自の sfGuardUserAdminForm クラスを作成しました。

そのクラスの構成メソッドで$this->setWidgets()は、個々の呼び出しではなく関数を使用していました$this->setWidget()

于 2010-07-05T14:30:48.800 に答える
0

管理者用の sfGuardUser モジュールを間違って生成すると、このエラーが見つかりました。代わりにプラグインに付属のモジュールを使用する必要があるため、間違っています。

于 2012-04-11T16:07:47.667 に答える