Support customization of slug order in routes #176

Open
jrgns opened this Issue Jan 30, 2012 · 5 comments

Comments

Projects
None yet
4 participants

jrgns commented Jan 30, 2012

When defining a function public function getCarAction($id), it creates the route /car/{id}.{_format}.

Why not support the following:

cars:
    resource: "@MyBundle/Resources/config/cars.yml"
    prefix: /{make}/

This will give you the route

/{make}/car/{id}.{_format}

To support the route, the function needs to be defined as getCarAction($make, $id), which then breaks the route generation, as it generates a route with to {makes} in.

Let the generator check if a parameter is already defined in the route before adding it.

@ghost ghost assigned everzet Jan 30, 2012

Owner

stof commented Jan 30, 2012

the issue is that the parameter is not defined yet: the resource is loaded first, and then imported with a prefix

Owner

everzet commented Jan 30, 2012

Yup. Prefixes are added after import. That's why prefixes are always static.

Owner

stof commented Jan 30, 2012

@everzet they can contain placeholders in 2.1

Owner

everzet commented Jan 30, 2012

@stof @jrgns added "look at placeholders in prefix possiblity" to my todo ;-)

jrgns commented Jan 30, 2012

Schweet, thanx!

@lsmith77 lsmith77 added this to the 2.0 milestone Jul 10, 2015

@lsmith77 lsmith77 modified the milestone: 2.0 Nov 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment