views:

149

answers:

2

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 !

A: 

I don't think there is a route parameter in sfRoute.

You might want instead to write a RewriteRule for that particular URL:

RewriteEngine On
RewriteRule ^/my-super-profile$ /myurl/1 [L,QSA]
Geoffrey Bachelet
A: 

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]
mere-teresa