/** * {@inheritdoc} * * @param \Phalcon\DI $di */ public function registerServices(DiInterface $di = null) { $di->getDispatcher()->setDefaultNamespace('Webird\\Web\\Controllers'); $di->setShared('view', $this->getViewFunc($di)); if (DEV_ENV === ENV) { $debugPanel = new DebugPanel($di); } // //Listen for events produced in the dispatcher using the Security plugin // $evManager = $di->getShared('eventsManager'); // // $evManager->attach("dispatch:beforeException", function($event, $dispatcher, $exception) use ($di) { // // switch ($exception->getCode()) { // // case Dispatcher::EXCEPTION_HANDLER_NOT_FOUND: // case Dispatcher::EXCEPTION_ACTION_NOT_FOUND: // // $dispatcher->forward([ // 'controller' => 'errors', // 'action' => 'show404', // ]); // // return FALSE; // break; // } // }); }
/** * {@inheritdoc} * * @param \Phalcon\DI $di */ public function registerServices(DiInterface $di = null) { $di->getDispatcher()->setDefaultNamespace('Webird\\Admin\\Controllers'); $di->setShared('view', $this->getViewFunc($di)); if (DEV_ENV === ENV) { $debugPanel = new DebugPanel($di); } }
/** * registering specific module services */ public function registerServices(DiInterface $di) { $di->set('view', function () { $oView = new View(); return $oView; }); $oLogger = $di->getFileLogger(); echo __FUNCTION__ . ' executed <br />' . PHP_EOL; // $oDispatcherEventsManager = new Manager(); /** * @type Dispatcher $oDispatcher */ $oDispatcher = $di->getDispatcher(); $oDispatcherEventsManager = $oDispatcher->getEventsManager(); $oDispatcher->setDefaultNamespace('App\\Modules\\Regular\\Controllers'); // // Регистрация диспетчера // $di->set('dispatcher', function() use($oDispatcherEventsManager) { // $dispatcher = new Dispatcher(); // $dispatcher->setEventsManager($oDispatcherEventsManager); // $dispatcher->setDefaultNamespace('App\Modules\Regular\Controllers'); // return $dispatcher; // }); $oDispatcherEventsManager->attach('dispatch', function ($event, $dispatcher, $exception) use($oLogger) { $oLogger->debug('module dispatcher: ' . $event->getType() . ': ' . $exception); }); // // // // // $oConfig = new Config(array( // 'application' => array( // 'viewsDir' => __DIR__ . '/views', // 'cacheDir' => __DIR__ . '/../../../var/cache/regular' // ), // )); // // $di->get('config')->merge($oConfig); // // // /** // * Setting up the view component // */ // $di->set('view', function () use ($di) { // // $view = new View(); // $oConfig = $di->getConfig(); // // $view->setViewsDir($oConfig->application->viewsDir); // //// $view->registerEngines(array( //// '.volt' => function ($view, $di) use ($oConfig) { //// //// $volt = new VoltEngine($view, $di); //// //// $volt->setOptions(array( //// 'compiledPath' => $oConfig->application->cacheDir, //// 'compiledSeparator' => '_' //// )); //// //// return $volt; //// }, //// '.phtml' => 'Phalcon\Mvc\View\Engine\Php' //// )); // // return $view; // }, true); // //// //// // Регистрация компонента представлений //// $di->set('view', function() { //// $view = new View(); //// $view->setViewsDir('../apps/backend/views/'); //// return $view; //// }); }
/** * Registers the module-only services * * @param \Phalcon\DiInterface $di */ public function registerServices($di) { $dispatcher = $di->getDispatcher(); $dispatcher->setDefaultNamespace('Eva\\EvaBlog\\Controllers'); }
/** * Registers the module-only services * * @param \Phalcon\DiInterface $di */ public function registerServices($di) { $dispatcher = $di->getDispatcher(); $dispatcher->setDefaultNamespace('Eva\\EvaUser\\Controllers'); static::registerGlobalServices($di); }
/** * {@inheritdoc} * * @param \Phalcon\DI $di */ public function registerServices(DiInterface $di = null) { $di->getDispatcher()->setDefaultNamespace('Webird\\Api\\Controllers'); $di->setShared('view', $this->getViewFunc($di)); }
/** * Registers the module-only services * * @param \Phalcon\DiInterface $di */ public function registerServices(DiInterface $di) { $dispatcher = $di->getDispatcher(); $dispatcher->setDefaultNamespace('Eva\\EvaMovie\\Controllers'); }