我正在尝试自定义 sfGuardUser 模块的形式。安装 sfGuardDoctrinePlugin 后,我遵循 Symfony 的级联配置约定并创建了以下结构:
apps/backend/modules/sfGuardUser
apps/backend/modules/sfGuardUser/config
apps/backend/modules/sfGuardUser/config/generator.yml
在 generator.yml
文件中,我尝试按照中的建议覆盖默认插件设置
this related question还有这个post in the official blog :
generator: class: sfDoctrineGenerator param: config: fields: first_name: label: Name last_name: label: Surname email_address: label: Email updated_at: label: Last update date_format: f list: title: People display: [=username, name, email_address, last_login] sort: [username, asc] filter: display: [username, first_name, last_name, email_address] edit: title: Edit "%%name%%" new: title: Add a new user form: display: "User": [first_name, last_name, email_address, username, password, password_again] "Permissions and groups": [is_active, is_super_admin, groups_list]
However the form still reflects the default settings. For instance, it's still displaying the permissions_list
.
Moreover, if you try to unset the widgets by overriding the sfGuardUserAdminForm you realize that it does not work either.
How can I avoid that and force a real overriding? Am I missing something?
Thanks!
UPDATE 1 I have found a workaround, which is assigning a false value to the group, and then set a new group with the fields I wanted:
"User": [first_name, last_name, email_address, username, password, password_again]
"Permissions and groups": false
"Status and groups": [is_active, is_super_admin, groups_list]
更新2 这是documented bug ,但似乎核心开发人员并没有处理它。该票证包含针对像我一样遇到此问题的人的补丁。
最佳答案
不幸的是,覆盖约定并不像您期望的插件的generator.yml 那样工作。最简单的方法是配置插件的generator.yml 文件,这就是我所做的。
您还可以将插件的generator.yml移动(而不是复制)到您的应用程序/模块。此线程还有一个有趣的解决方案:http://oldforum.symfony-project.org/index.php/m/43279/
关于symfony1 - 交响乐团 : customizing sfDoctrineGuardPlugin modules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5324421/