symfony1 - 交响乐团 : customizing sfDoctrineGuardPlugin modules

标签 symfony1 customization generator sfdoctrineguard

我正在尝试自定义 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/

相关文章:

wordpress - 如何自定义默认的 wordpress 编辑器?

python - 这是生成器表达式吗?

javascript - 与 bluebird 和 co 一起快速生成生成器功能

php - 在没有 http ://in symfony 的情况下验证 url

php - 在 symfony 中更好地使用模型和迁移

android - 如何在 Android 中为 ViewPager 添加圆点?

android - AOSP vanilla Android 移植到非 Nexus 设备 - 编写设备树和内核

python - 如何在循环中调用带有非类型函数的生成器类型函数?

php - 没有 PHP 经验的人应该使用像 CakePHP 或 Symfony 这样的框架吗?

symfony1 - 新部署后 symfony 默认上下文不存在