Hello there,
English is not my first language and my problem is too complex to translate it in clear english. Thanks you for patience.
I'm trying to setup Phalcon for my next project setup. Due to our projects nature I have a relatively complex project layout. In my project, I had unlimited multimodule apps.
It was something like.
/app
/app/app1/modules/modules1/controllers
/app/app1/modules/modules2/controllers
/app/app2/modules/modules1/controllers
etc
To manage routing and loading I have a small router code which works before Phalcon config. I get current app, module, controller, action and parameters from the URL then modify the Phalcon config. So I reach the multi app with multi module setup.
My Old Setup config
'dirs' => array(
'appDir' => preRouter::$appDir,
'moduleDir' => preRouter::$moduleDir,
'controllersDir' => preRouter::$moduleDir.'controller'._DS_,
'libraryDir' => SYS_DIR.'library'._DS_,
),
'prefix'=> array(
'service_'=> SYS_DIR.'service'._DS_,
'repository_'=> SYS_DIR.'repository'._DS_,
'form_'=> SYS_DIR.'form'._DS_,
'model_'=> SYS_DIR.'model'._DS_,
'task_'=> SYS_DIR.'task'._DS_,
'daemon_'=> SYS_DIR.'daemon'._DS_,
),
However this config based on register dirs which costs lots of file search.
I want to move my structure from $loader->registerDirs to $loader->registerPrefixes
My attempts to archieve this have failed. I can manually load the controller class however dispatcher cannot load it.
/var/www/orkun/app/admin/default/controller/IndexController.php
/var/www/orkun/app/admin/default/base.php
/var/www/orkun/app/admin/base.php
/var/www/orkun/app/base.php
IndexController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('IndexController...', 2)
#1 /var/www/orkun/pub/index.php(146): Phalcon\Dispatcher->dispatch()
#2 {main}
My New Setup Config
'prefix'=> array(
'app_'=> APP_DIR,
'lib_'=> LIB_DIR,
),
Is there any $dispatcher example based on registerPrefxes.
My Best Regards