Routing not working in Multiple-Factory-Default

I have created yesterday new project with phalcon developer tools with option "multi".

I have got structure like this:

app

--> Core

--> User

    --> Controller

       --> SecurityController.php

   --> View

       --> Security

            --> login.phtml

config

public

In config/services.php I have changed routing to look like:

$di['router'] = function () {

$router = new Router();
$router->add('/login', array(
                          'module' => 'User',
                          'controller' => 'Security',
                          'action' => 'login',
                  ));
 return $router;

};

But when I am trying to access http://example.com/login, I am getting this error:

SecurityController handler class cannot be loaded

Can someone please let me know what I am doing wrong?



3.9k

This seems to be working when I will add

$router->setDefaultNamespace("TrebionCRM\User\Controller");

But then it doesn't work if I will add e.g.

$router->add('/index', array( 'module' => 'Core', 'controller' => 'Index', 'action' => 'index', ));

so it is working then for just one Module and when I am going to http://example.com/index I am getting this exception

TrebionCRM\User\Controller\IndexController handler class cannot be loaded

Why is it trying to load it for User module, not Core module?