In symfony2 routing.yml I am trying to create a route with optional parameters like this:
/app/type/{typeValue}/page/{page}
So, an example that would work is:
/app/test/type/hello/page/1
My route is:
api_test:
pattern: /api/test/type/{typeValue}/page/{page}
defaults: { _controller: TestCoreBundle:Json:test, page:1 }
This is fine but i want to have /type/{typeValue} and /page/{page} optional so it works also for urls like this:
/app/test
/app/test/page/3
/app/test/type/myType
My other routes will also contain more complicated optional parameters so it is important for me to solve this problem. What do I need to do so that I dont need to create separate routes so it supports every single combination?