出现此错误:窗口小部件“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.')));
}
}
这又没有改变。所以我不太确定下一步该怎么做才能使它发挥作用。
有什么想法吗?
答案 0 :(得分:1)
感谢您的评论johnwards
我自己设法解决了这个问题。
基本上我已经创建了自己的sfGuardUserAdminForm类来覆盖默认值。
在该课程的“配置方法”中,我使用的是$this->setWidgets()
功能,而不是单独调用$this->setWidget()
答案 1 :(得分:0)
我错误地为管理员生成sfGuardUser模块后发现此错误。这是错误的,因为我应该使用插件附带的模块。