I'm new to Symfony framework. Currently I have route in mybundle/Resources/config/routing.yml:
fcr_category_head:
path: head/{slug}/{city}/{page}
defaults: { _controller: AppBundle:Head:index, slug: "", city: "all", page: 1 }
requirements: {page: "\d+"}
the problem is that city option is available when user uses filter to narrow results to selected city, if city does not exist, the second parameter should be page.
so route variations can be like this:
head/slug/city //default page 1 if city is not a number, if number then it is page
head/slug/city/10 //e.g page 10
head/slug/10 //no city parameter, because it is number, page 10
is it possible to make these combinations in routing file or the only way to solve this is tho write my own logic in controller?
Thank you.
cityhas to be in this format. I think it is mostly for SEO, other filter parameters will be defined as query parameters as you suggested.