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

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

        $this->dispatcher->setModuleName('backend');
        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



30.7k
edited Oct '16

Hi,

don't work

what do you exactly get ?

from: https://docs.phalconphp.com/en/latest/api/Phalcon%5Mvc%5Dispatcher.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.phalconphp.com/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.