symfony 更改对象操作的 url
我有一个对象操作 approve
,我想将其 url 从 /module/ListApprove/action?id=XXX
更改为 /module/:slug/批准。我尝试在
routing.yml
中添加路由,但没有帮助。另外,我在操作中定义了 ecexuteApprove
。
修改routing.yml
:
poster_approve:
url: /poster/:slug/approve
params: {module: poster, action: approve}
poster:
class: sfDoctrineRouteCollection
options:
model: Poster
module: poster
prefix_path: /poster
column: slug
with_wildcard_routes: true
当我手动调用/poster/someslug/approve
时,它工作正常。但在管理列表界面的 actions 栏中,approve 的 url 不是 /poster/someslug/approve
,而是 /poster/ListApprove/action?id=12
/poster/ListApprove/action?id=12代码>.
之后,我向 generator.yml
添加了一个操作参数,如下所示:
object_actions:
_delete:
credentials: delete_poster
approve:
credentials: approve_poster
action: approve
但这次唯一的变化是,链接网址变为 /poster/approve/action?id=12
。我该如何改变这个?
I have an object action approve
and I'd like to change its url from /module/ListApprove/action?id=XXX
to /module/:slug/approve
. I have tried adding a route in routing.yml
but no help. Also, I have ecexuteApprove
defined in my action.
modified routing.yml
:
poster_approve:
url: /poster/:slug/approve
params: {module: poster, action: approve}
poster:
class: sfDoctrineRouteCollection
options:
model: Poster
module: poster
prefix_path: /poster
column: slug
with_wildcard_routes: true
when I manually call /poster/someslug/approve
, it works fine. But in the admin list interface, in the actions column, the url for approve is not /poster/someslug/approve
, instead it is /poster/ListApprove/action?id=12
.
After it I added an action parameter to my generator.yml
like this:
object_actions:
_delete:
credentials: delete_poster
approve:
credentials: approve_poster
action: approve
but the only change this time is, the link url becomes /poster/approve/action?id=12
. How do I change this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的routing.yml操作是什么样的?您可以添加类似以下内容:
请定义但没有帮助,您遇到了什么问题?
How does your routing.yml action look like? You could add something like:
Please define but no help, what problem are you encountering?