I am creating an application with various modules and currently it uses the following code to disable all the view in each module:
namespace Multiple\Frontend;
class Module {
public function registerAutoloaders() {
$loader = new \Phalcon\Loader();
$loader->registerNamespaces(array(
'Multiple\Frontend\Controllers' => __DIR__ . '/controllers/',
'Multiple\Frontend\Models' => __DIR__ . '/models/',
));
$loader->register();
}
public function registerServices($di) {
$di->set('dispatcher', function() {
$dispatcher = new \Phalcon\Mvc\Dispatcher();
$dispatcher->setDefaultNamespace('Multiple\Frontend\Controllers\\');
return $dispatcher;
});
$di->set('view', function() {
$view = new \Phalcon\Mvc\View();
$view->disable(); // <---------------------------------------------------
return $view;
});
}
}
I would like to know there is a smarter way to do this only once for the entire system.