public function getListBaseType($type) { try { $dbResult = DB::select('*')->from('News')->where('Type', $type)->execute(); return $this->format($dbResult->as_array()); } catch (\Exception $e) { ErrorMsg::_log($e); return null; } }
public function getListBaseType() { // Make query field $field_list = array('ID', 'PostBy', 'Title', 'Description', 'DateCreate', 'Type', 'Tag', 'Views'); try { $dbObj = DB::select_array($field_list)->from('News'); if ($this->_type != 0) { $dbObj->where('Type', $this->_type); } $dbObj->order_by('DateCreate', 'dsc'); // ->limit($this->_size) // ->offset(($this->_page - 1) * 10) $dbResult = $dbObj->execute(); return $dbResult->as_array(); } catch (\Exception $e) { ErrorMsg::_log($e); return null; } }