Archived
1
0
Fork 0

move app/plugins to app/listeners and give them the App\Listener namespace.

This commit is contained in:
Henrik Hautakoski 2018-04-02 23:25:05 +02:00
parent a72932a7ad
commit 6ed63d591f
5 changed files with 17 additions and 15 deletions

View file

@ -4,7 +4,7 @@ application:
modelsDir : ../app/models/
migrationsDir : ../app/migrations/
viewsDir : ../app/views/
pluginsDir : ../app/plugins/
listenersDir : ../app/listeners/
libraryDir : ../app/library/
formsDir : ../app/forms/
logDir : ../cache/log/

View file

@ -2,20 +2,14 @@
$loader = new \Phalcon\Loader();
/**
* We're a registering a set of directories taken from the configuration file
*/
$loader->registerDirs(
array(
$config->application->pluginsDir
)
)->register();
$loader->registerNamespaces(array(
'App\Controller' => $config->application->controllersDir,
'App\Listener' => $config->application->listenersDir,
'Model' => $config->application->modelsDir,
'Form' => $config->application->formsDir,
'Httpcb' => $config->application->libraryDir,
));
$loader->register();
require_once __DIR__ . '/../../vendor/autoload.php';

View file

@ -29,6 +29,9 @@ use Httpcb\Auth,
Httpcb\Navigation,
Httpcb\Menu;
use App\Listener\AclListener,
App\Listener\DispatchListener;
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
*/
@ -54,10 +57,10 @@ $di->setShared('dispatcher', function() use ($di, $config) {
});
if ($config->application->debug == false) {
$eventsManager->attach('dispatch:beforeException', new \ExceptionHandlerPlugin());
$eventsManager->attach('dispatch:beforeException', new DispatchListener());
}
$eventsManager->attach('dispatch:beforeExecuteRoute', new \AclPlugin());
$eventsManager->attach('dispatch:beforeExecuteRoute', new AclListener());
$dispatcher = new \Phalcon\Mvc\Dispatcher();
$dispatcher->setEventsManager($eventsManager);