We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Merge getParam of Phalcon\Mvc\Dispatcher and getQuery of Phalcon\Http\Request

I want to handle basic url [https://someurl/edit/17] as well friendly url [https://someurl/edit?id=17]

I can write route for both the url

But in my action I have to check request object as well as dispatcher object to get the id param

Is there any way I can merger this object or their methods so that I can get param from both url in single object & method call?



34.6k
Accepted
answer

Maybe you can use method reflection to assign the value in the dispatcher: https://docs.phalcon.io/en/latest/reference/dispatching.html#preparing-parameters