Hi all,
At multi-module docs I can see examples of how to route them, as well in the mvc repository in github. But I can't find an example with a generic solution. All the examples I saw define specific routers for the modules. What I really want is the router to handle it, as it does with controllers/actions but with modules.
At the moment I already have a multimodule skeleton, the loader is working ok with different namespaces across modules etc, but I can't get the router to reach other modules than the default one.
This is what I have:
$di['router'] = function () {
$router = new \Phalcon\Mvc\Router();
$router->setDefaultNamespace('App\Base\Controllers');
$router->setDefaultModule("base");
$router->add('/:module/:controller/:action',
array(
'module' => 1,
'controller' => 2,
'action' => 3,
)
);
return $router;
};
with the bootstrap application as follows
$application->registerModules( array(
'base' => array(
'className' => 'App\Base\Module',
'path' => $config->loader->modules_path.'Base'.DS.'Module.php'
),
'user' => array(
'className' => 'App\User\Module',
'path' => $config->loader->modules_path.'User'.DS.'Module.php'
)
));
if I access to route / it goes to base module, IndexController, indexAction, but it does the same whatever the route I write. What I'm doing wrong?
I'm so sorry for writing this since there is a lot of routing questions related to autoloading of multi module applications but I couln't find anything.