Added method addForm to DB_Model

This commit is contained in:
bison-paolo
2017-02-15 12:50:50 +01:00
parent 57520c1ae4
commit bf677f717e
+23
View File
@@ -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
*