envirment: win7x64, WAMP-2.5 phalcon-2.0.0
I copied multiple from
https://github.com/phalcon/mvc
and it's easy to access the samples
but if I wan't to add some more controllers and actions in "backend" module, the router would guite the program to the frontend module
<?php
error_reporting(E_ALL);
class Application extends \Phalcon\Mvc\Application {
/** * Register the services here to make them general or register in the ModuleDefinition to make them module-specific */ protected function _registerServices() { $di = new \Phalcon\DI\FactoryDefault(); $loader = new \Phalcon\Loader(); /** * We're a registering a set of directories taken from the configuration file */ $loader->registerDirs( array( __DIR__ . '/../apps/library/', ) )->register(); //Registering a router $di->set('router', function () { $router = new \Phalcon\Mvc\Router(); $router->setDefaultModule("Entrance"); $router->add('/:controller/:action', array( 'module' => 'entrance', 'controller' => 1, 'action' => 2, )); $router->add("/functions1/:controller/:action", array( 'module' => 'function1', 'controller' => 1, 'action' => 2, )); return $router; }); $di->set('url', function () { $url = new \Phalcon\Mvc\Url(); $url->setBaseUri('/myproject'); return $url; }); $this->setDI($di); } public function main() { $this->_registerServices(); //Register the installed modules $this->registerModules(array( 'Entrance' => array( 'className' => 'Multiple\Entrance\Module', 'path' => '../apps/entrance/Module.php', ), 'Impellerhelper' => array( 'className' => 'Multiple\Function1\Module', 'path' => '../apps/Function1/Module.php', ), )); echo $this->handle()->getContent(); }
}
$application = new Application(); $application->main();
for example it's easy to access
https://localhost/myproject/entrance
https://localhost/myproject/function1
but if I add SomeController in function1 module, it will fail
https://localhost/myproject/function1/some
the error message is
Phalcon\Mvc\Dispatcher\Exception: Multiple\Entrance\Controllers\SomeController handler class cannot be loaded
Can anyone help me?