有没有一种聪明的方法来覆盖 sfDoctrineGuard 插件中的表单操作链接?

发布于 2024-11-04 00:38:05 字数 1199 浏览 10 评论 0原文

我已经设置了 Symfony 1.4 项目,将 URL 中的 /admin 路由到我的后端应用程序。在我想要编辑用户或以任何方式与生成的表单交互之前,这一切都很好。这是因为生成的链接不知道我的 /admin 前缀。

有没有一种聪明的方法来为这些链接添加前缀,而无需将生成的模板复制到我的应用程序文件夹结构中?

更新

sfGuardUser 模块的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:
          "User":                   [first_name, last_name, email_address, 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

我在routing.yml 中添加了自己的sf_guard_user,它适用于我创建的新链接,但生成器不会选择它。

I've set up my Symfony 1.4 project to route /admin in the URL to my backend app. This works fine until I want to edit a user or interact with the generated forms in any way. This is because the generated links are not aware of my /admin prefix.

Is there a smart way to prefix these links without copying the generated templates to my app folder structure?

UPDATE

Contents of generator.yml for the sfGuardUser module:

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:
          "User":                   [first_name, last_name, email_address, 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

I have added my own sf_guard_user in my routing.yml which works for new links I create but the generator doesn't pick this up.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烏雲後面有陽光 2024-11-11 00:38:05

查看管理生成器的示例配置文件 (generator.yml): http://www.symfony-project.org/jobeet/1_4/Doctrine/en/12#chapter_12_final_configuration

大多数具体来说,查看route_prefix:参数。

尝试将route_prefix设置为

route_prefix: admin

Take a look at a sample configuration file for the admin generator (generator.yml): http://www.symfony-project.org/jobeet/1_4/Doctrine/en/12#chapter_12_final_configuration

Most specifically, look at the route_prefix: parameter.

Try setting the route_prefix to

route_prefix: admin
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文