Exemplo n.º 1
0
 protected function initRoutes()
 {
     $routes = new \Espo\Core\Utils\Route($this->getContainer()->get('config'), $this->getMetadata(), $this->getContainer()->get('fileManager'));
     $crudList = array_keys($this->getContainer()->get('config')->get('crud'));
     foreach ($routes->getAll() as $route) {
         $method = strtolower($route['method']);
         if (!in_array($method, $crudList)) {
             $GLOBALS['log']->error('Route: Method [' . $method . '] does not exist. Please check your route [' . $route['route'] . ']');
             continue;
         }
         $currentRoute = $this->getSlim()->{$method}($route['route'], function () use($route) {
             //todo change "use" for php 5.4
             return $route['params'];
         });
         if (isset($route['conditions'])) {
             $currentRoute->conditions($route['conditions']);
         }
     }
 }
Exemplo n.º 2
0
 protected function getRouteList()
 {
     $routes = new \Espo\Core\Utils\Route($this->getContainer()->get('config'), $this->getMetadata(), $this->getContainer()->get('fileManager'));
     return $routes->getAll();
 }