Symfony中的路由异常(";The";/League/:ID_League/Members/new";Routing有一些缺少的必选参数(:ID_League)";)
大家好,很抱歉我的英语不好
我有一个问题:在联盟的Members页面("/League/ID_League/Members")中,操作"new"的链接变成了"/League/Members/News"(联盟的id消失了)。 我想保留该ID并创建一个类似"/League/ID_League/Members/new"的URL,这样您就可以在选择框中选择当前的联赛...
我正在尝试执行以下操作
members: class: sfDoctrineRouteCollection options: { model: Members, module: members, column: id_member, with_wildcard_routes: true } # List to league (id)'s members memebers_league: url: /league/:id/members options: { model: Members, type: list } param: { module: members, action: index } # New member members_new: url: /league/:id_league/members/new class: sfDoctrineRoute options: { model: Members, type: object } param: { module: members, action: new }
对于这些路由,我得到的例外是"The"/League/:ID_League/Members/new"路由有一些缺少的强制参数(:ID_ALILEL)"(在"Members.class.php"中有getIdLeague())。
有人能帮我吗?
提前谢谢
解决方案
添加默认值:
param: { module: members, action: new, id_league: 0}
相关文章