Example #1
0
 public function getCollection()
 {
     if ($this->_collection === null) {
         $collection = new RoutingCollection();
         $result = $this->connection->fetchAll('SELECT id, methods, path, controller, config FROM fusio_routes WHERE status = 1');
         foreach ($result as $row) {
             $config = !empty($row['config']) ? unserialize($row['config']) : array();
             $collection->add(explode('|', $row['methods']), $row['path'], $row['controller'], $config);
         }
         $this->_collection = $collection;
     }
     return $this->_collection;
 }
Example #2
0
 public function getCollection()
 {
     if ($this->_collection === null) {
         $sql = 'SELECT id,
                        methods,
                        path,
                        controller
                   FROM fusio_routes
                  WHERE status = :status';
         $collection = new RoutingCollection();
         $result = $this->connection->fetchAll($sql, ['status' => TableRoutes::STATUS_ACTIVE]);
         foreach ($result as $row) {
             $collection->add(explode('|', $row['methods']), $row['path'], $row['controller'], $row['id']);
         }
         $this->_collection = $collection;
     }
     return $this->_collection;
 }