Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon access module properties / methods

In Phalcon Multi Module structure i thought it is possible to query between 2 different modules.

Like accessing :

properties / methods from Module A controller / model in Module B controller / model by using DISPATCHER.

But its not working.

If there is a global module which need to be accessed by other modules for some data, how do we do it?

Also looks like $Response->redirect() will also not work.



You can upload your code??


From Module A / Controller, If i dispatch within the same Module. Its working Perfectly.

$this->dispatcher->forward(array( 'controller' => 'Index', 'action' => 'test' ));

If i try to send dispatch to the different modules controller, Its not working.

$this->dispatcher->forward(array( 'module' => 'module_B', 'controller' => 'Index', 'action' => 'showdata' ));



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


OK, So Dispatcher is working winthin a Module. Fine.

But atleast is there a way to access properties or methods of Controller MODULE B from Controller MODULE A?

edited Apr '14

When you use multi-module in index.php files include multi-module or A special bootstrap file is required to load the a multi-module MVC architecture, //Create an application $application = new Application($di);

    // Register the installed modules
            'frontend' => array(
                'className' => 'Multiple\Frontend\Module',
                'path'      => '../apps/frontend/Module.php',
            'backend'  => array(
                'className' => 'Multiple\Backend\Module',
                'path'      => '../apps/backend/Module.php',

    //Handle the request
    echo $application->handle()->getContent();

this is mean use dispatcher below alway working any module above

$this->dispatcher->forward(array( 'controller' => 'Index', 'action' => 'test' ));