2010-07-05 51 views
0

出現此錯誤:Widget「password_again」不存在。Widget「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.'))); 
    } 
} 

這又沒有被改變。所以我不太確定接下來要做什麼才能使它工作。

任何想法?

+1

是sfGuard及其提供的所有類,無論如何都是用戶的,未觸及過,並且處於安裝狀態?你也可以粘貼(如果你想要的話,pastebin)完整的堆棧跟蹤。 – johnwards 2010-07-05 14:10:59

回答

1

感謝您的意見johnwards

我已經設法解決這個問題。

基本上我做了我自己的sfGuardUserAdminForm類來覆蓋默認值。

在該類的配置方法,我用的是$this->setWidgets()函數,而不是單獨的呼叫$this->setWidget()

0

我發現這個錯誤,一旦我錯我產生了管理員的sfGuardUser模塊。這是錯誤的,因爲我應該使用插件附帶的模塊。