1
votes

Hi everyone and sorry for my bad english,

I have a problem with the routing: in the members page to a league ("/league/ID_LEAGUE/members"), the link for the action "new" becomes "/league/members/news" (the league's id disappears). I would like to keep that ID and create a url like "/league/ID_LEAGUE/members/ new" so you can select in selectbox the current league...

I'm trying to do this as follows

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 }

With these routes I get this exception "The "/league/:id_league/members/new" route has some missing mandatory parameters (:id_league)" (in "Members.class.php" there is the getter "getIdLeague() ).

someone could help me?

thanks in advance

1
What is the code for building the link?Visavì

1 Answers

1
votes

Add a default value :

param:   { module: members, action: new, id_league: 0}