Hello. I have the next folder structure:
app
|-config
|-RoutesGroup.php
|-controllers
|-CustomFolder
|-TestBaseController.php
|-TestController.php
|-MyFolder
|-MyController.php
public
|-index.php
I have in my index.php:
<?php
//Autoloader
$o_loader = new \Phalcon\Loader();
$o_loader->registerDirs([
'../app/controllers/'
, '../app/models/'
, '../app/config/'
]);
$o_loader->registerNamespaces([
'App\Controllers\customFolder' => '../app/controllers/customFolder/',
'App\Controllers\myFolder' => '../app/controllers/myFolder/',
]);
$o_loader->register();
//Routing
$o_di->set('router', function () {
$o_router = new \Phalcon\Mvc\Router(false);
$o_router->mount(new RoutesGroup(array('namespace' => 'App\Controllers\CustomFolder')));
return $o_router;
});
An in my RoutesGroup.php
<?php
use Phalcon\Mvc\Router\Group;
class RoutesGroup extends Group {
public function initialize($config) {
if (array_key_exists('perfix', $config)) {
$this->setPrefix('/' . $config['perfix']);
}
$this->add('/:controller/:action/', array(
'namespace' => $config['namespace'],
'controller' => 1,
'action' => 2
));
}
}
My local domain is https://gms.phalcon.
When I try to execute https://gms.phalcon/test/index, the server resonse is:
IndexController handler class cannot be loaded
What I'm doing wrong?