I would like to define the following default behavior on my routes:
Url: myapp.com/mymodule/mycontroller/myaction/q/someTerm/key/someValue/key2/anotherValue
This url should give the dispatcher the following params:
array(
'q' => 'someTerm',
'key' => 'someValue',
'key2' => 'anotherValue'
):
I know it can be easily done by extending the router and implementing my own, but I was wondering if Phalcon has a default flag that switches that approach on by default.
Right now, if I apply the route
':module/:controller/:action/:params' to this URL, I get the following params:
array(
0 => 'q',
1 => 'someTerm',
2 => 'key'
... etc
);
Which is something I don't want.
If the Phalcon router doesn't have a default flag that does this, is there an event that fires immediately before the params become available in the DI's dispatcher in the controller? I would like to manually map them into key=>value pairs at least, before they reach the controller.
Edit: I am now looking into the beforeExecuteRoute event in the controller, should do what I need. But I'd still like it if the router did this automatically - sometimes params aren't in a fixed order, or some of them just disappear (think complex search queries).