Is there a smart way to override form action links in sfDoctrineGuard plugin?

459 Views Asked by At

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.

1

There are 1 best solutions below

1
On

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