Example #1
0
 /**
  * @param RegisterService $registerService
  */
 public function register(RegisterService $registerService)
 {
     $router = new PhalconRouter();
     $registerService->getDependencyInjection()->set('router', $router);
     $cacheDir = $registerService->getProjectPath() . '/' . Module::COMMON_CACHE;
     $load = new Load($cacheDir);
     $load->execute(Route::CACHE_FILE, function () use($router) {
         _loadRoutes($router);
     });
 }
Example #2
0
 public function runAction($params)
 {
     $cacheDir = $params[0] . '/' . Module::COMMON_CACHE;
     $load = new Load($cacheDir);
     $router = new RouterDump();
     $load->execute(Route::CACHE_FILE, function () use($router) {
         _loadRoutes($router);
     });
     $this->output()->writeln('');
     $this->output()->writelnStyle('Router:', new Style('white', 'blue', 'bold'));
     foreach ($router->getRoutes() as $route) {
         $this->output()->write("path: \"");
         $this->output()->writeFormat($route['route'], 'info_bold');
         $this->output()->write("\" -> ");
         $this->output()->writeln(sprintf("%s/%s/%s", $route['data']['module'], $route['data']['controller'], $route['data']['action']));
     }
 }