diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index 4a7e561d8..db6e11408 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -429,6 +429,29 @@ class DB_Model extends FHC_Model return success(true); } + /** --------------------------------------------------------------- + * Add a table in the from clause + * + * @return void + */ + public function addFrom($table, $alias = null) + { + $tmpTable = trim($table); + + // Check parameters + if (empty($tmpTable)) + return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR); + + if (!empty($alias)) + { + $tmpTable .= ' AS ' . $alias; + } + + $this->db->from($tmpTable); + + return success(true); + } + /** --------------------------------------------------------------- * Reset the query builder state *