1

开发一个插件,我的插件目录中有一个 routing.yml,用 sfPropelRoute 指定一个路由。

在我的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]

它工作正常。

但是,在我的应用程序(apps/myapp/config/routing.yml)中,我想定义一个绝对 URL,具有人类意义,我想做这样的路由:

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

显然,我的语法不正确!

4

2 回答 2

0

我认为routesfRoute 中没有参数。

您可能希望为该特定 URL 编写一个 RewriteRule:

RewriteEngine On
RewriteRule ^/my-super-profile$ /myurl/1 [L,QSA]
于 2010-05-19T08:31:36.907 回答
0

作为记录,我改变了我的方法(避免 URL 重写),我现在使用一个 slug。

在我的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]
于 2010-05-19T12:13:00.213 回答