コード例 #1
0
ファイル: Modules.php プロジェクト: logikostech/core
 protected function initModuleRouting(Application $app)
 {
     // note, it is important that the default module is registered first..
     // though if user uses Phalcon\Mvc\Router these default routes are not needed
     if ($this->isModuleDefined($app->getDefaultModule())) {
         $this->routeModule($app->getDefaultModule());
     }
     foreach ($this->getModules() as $moduleName => $module) {
         if (!$this->isDefaultModule($moduleName)) {
             $this->routeModule($moduleName);
         }
     }
 }
コード例 #2
0
     * Handle the request
     */
    $application = new Application($di);
    $application->setEventsManager($oAppEventsManager);
    $oAppEventsManager->attach('application', function ($event, $application) use($oLogger) {
        $oLogger->debug('application: ' . $event->getType());
    });
    //	$application->registerModules();
    //	$arNamespaces = $di->getLoader()->getNamespaces();
    /**
     * here's all the magic with modules
     */
    $oModuleRouter = new ModuleRouter($application);
    if ($oModuleRouter->handle()) {
        $oLogger->debug('app modules registered: ' . print_r($application->getModules(), true));
        $oLogger->debug('app default module: "' . $application->getDefaultModule() . '"');
        //		$oRouter = new AppRoute();
        //		$di->set('router', $oRouter);
        echo $application->handle()->getContent();
    } else {
        //		running old application
        require_once __DIR__ . '/../legacy/public/index.php';
    }
} catch (\Exception $e) {
    echo '<h3>' . $e->getMessage() . '</h3>';
    echo '<h2>' . $e->getLine() . ': ' . $e->getFile() . '</h2>';
    $arTrace = $e->getTrace();
    foreach ($arTrace as $offset => $line) {
        echo '<p><b>' . $offset . ':</b> ' . print_r($line, true) . '</p>';
    }
    $oLogger->error($e->getLine() . ':' . $e->getFile() . ':' . get_class($e) . ' "' . $e->getMessage() . '"');