Search code examples
routessymfony1propel

Reference another route in your routing.yml in Symfony?


Developping a plugin, I have a routing.yml in my plugin dir, specifying a route with sfPropelRoute.

in my plugins/myPlugin/config/routing.yml :

myplugin_test:
  url:   /myurl/:id
  class:   sfPropelRoute
  options: { model: myClass, type: object, method_for_criteria: selectAvailableObj }
  params: { module: mymodule, action: show }
  requirements:
    sf_method: [GET, POST]

it works fine.

But, in my app (apps/myapp/config/routing.yml), I want define an absoulute URL, with human meaning I want to do a routing like this :

my_profile:
  url:   /my-super-profile
  class: sfRoute
  params: { route: @myplugin_test, id: 1 }

Obviously, my syntax is not the right one !


Solution

  • For the record, I change my method (avoiding the URL rewriting) and I now use a slug.

    in my plugins/myPlugin/config/routing.yml :

    myplugin_test:
      url:   /myurl/:slug
      class:   sfPropelRoute
      options: { model: myClass, type: object }
      params: { module: mymodule, action: show}
      requirements:
        sf_method: [GET, POST]