I made a project with modules type with this command
phalcon project simkontrolprogja --type=modules
When i am adding new module in my project called administrator by use this command
phalcon module administrator
i have add the module on config/loader.php
$loader->registerClasses([
'Simkontrolprogja\Modules\Frontend\Module' => APP_PATH . '/modules/frontend/Module.php',
'Simkontrolprogja\Modules\Administrator\Module' => APP_PATH . '/modules/administrator/Module.php',
'Simkontrolprogja\Modules\Cli\Module' => APP_PATH . '/modules/cli/Module.php'
]);
On bootsrap_web.php
$application->registerModules([
'frontend' => ['className' => 'Simkontrolprogja\Modules\Frontend\Module'],
'admin' => ['className' => 'Simkontrolprogja\Modules\Administrator\Module'],
]);
On Module.php
/**
* Registers an autoloader related to the module
*
* @param DiInterface $di
*/
public function registerAutoloaders(DiInterface $di = null)
{
$loader = new Loader();
$loader->registerNamespaces([
'Simkontrolprogja\Administrator\Controllers' => __DIR__ . '/controllers/',
'Simkontrolprogja\Administrator\Models' => __DIR__ . '/models/'
]);
$loader->register();
}
and when i try to access the module, this is happen
IndexController.php
namespace Simkontrolprogja\Modules\Administrator\Controllers;
class IndexController extends ControllerBase
{
public function indexAction()
{
}
}
Hope some body help me to solve this problem.