Symfony1 小部件;密码“再次输入”;不存在

Symfony1 小部件;密码“再次输入”;不存在,symfony1,symfony-forms,sfguard,sfdoctrineguard,Symfony1,Symfony Forms,Sfguard,Sfdoctrineguard,出现此错误:小部件“再次输入密码”不存在 我想不出它为什么突然出现了。我正在使用随sfDoctrineGuard插件提供的默认生成器文件 plugins/sfDoctrineGuardPlugin/modules/sfGuardUser/config/generator.yml generator: class: sfDoctrineGenerator param: model_class: sfGuardUser theme: ad

出现此错误:小部件“再次输入密码”不存在

我想不出它为什么突然出现了。我正在使用随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
此处是对字段密码\u的唯一其他引用:

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.')));
  }
}
这一点也没有改变。所以我不太确定下一步该怎么做才能让它起作用


有什么想法吗?

谢谢你的评论,约翰沃兹

我自己设法解决了这个问题

基本上,我创建了自己的sfGuardUserAdminForm类来覆盖默认值


在那个类的configure方法中,我使用了
$this->setWidgets()
函数,而不是单独调用
$this->setWidget()

当我错误地为管理员生成sfGuardUser模块时,我发现了这个错误。这是错误的,因为我应该使用插件随附的模块。

sfGuard及其提供的所有类(用户类)是否未被触及,并且处于您安装它们时的状态?你也可以粘贴(如果你想粘贴的话)完整的堆栈跟踪。