We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

how to use $this->dispatcher->forward with modules?

how to use $this->dispatcher->forward with modules?

        return $this->dispatcher->forward(
                "namespace"  => "Application\Controllers\Backend",
                "module"     => "backend",
                "controller" => "node",
                "action"     => "new",

don't work

or how saving GET/POST variables on redirection? or redirect with parameters or form data

edited Oct '16


don't work

what do you exactly get ?

from: https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_Dispatcher.html (function: forward)

Forwards the execution flow to another controller/action Dispatchers are unique per module. Forwarding between modules is not allowed

Maybe redirect can help you: https://docs.phalcon.io/en/latest/reference/response.html#making-redirections

edited Oct '16

Short answer - you can't.

Longer answer - you need to load proper namespace from other module to which you want forward to in module from which you are forwarding. and use namespace parameter in forward. Keep in mind that any services, classes etc used in this other module and controller you need to register them as well in your current module.

Module key in forward is not even needed.