foreveralone

foreveralone Commit Details


Date:2016-02-21 17:34:19 (8 years 10 months ago)
Author:Natalie Adams
Branch:master
Commit:7dfeb968edae49776c4ae545fffc5313de92d773
Parents: 01ba0646f8a3725c201c1c204ec0233d056aca46
Message:Updating framework

Changes:

File differences

web/system/engine/hf_core.php
307307
308308
309309
310
310311
311
312
312313
313314
314315
public function runMigrations() {
global $argv;
$this->setupDatabaseConnection();
$autoIncrement = \system\engine\HF_Model::AUTOINCREMENT_SQLITE;
DB::query("CREATE TABLE IF NOT EXISTS migrations (
id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
id INTEGER PRIMARY KEY $autoIncrement,
migration INTEGER,
ran_at DATETIME
)");
web/system/engine/hf_model.php
77
88
99
10
11
12
13
1014
1115
1216
......
2933
3034
3135
32
36
3337
3438
3539
......
7478
7579
7680
81
82
83
84
85
86
87
7788
abstract class HF_Model {
public $id = null;
const AUTOINCREMENT_SQLITE = "AUTOINCREMENT";
const AUTOINCREMENT_MYSQL = "AUTO_INCREMENT";
public static function create($data) {
$obj = new static();
$fieldMap[$column] = $this->$column;
}
if ($fieldMap["id"] == null) {
DB::insert($table, $fieldMap);
$this->id = DB::insert($table, $fieldMap);
} else {
$updateFields = $fieldMap;
unset($updateFields["id"]);
return DB::fetchObject("SELECT $fields FROM $table WHERE $field = ?", get_called_class(), [$value]);
}
public static function all() {
$function = new \ReflectionClass(get_called_class());
$table = strtolower($function->getShortName());
$fields = implode(", ", DB::getColumns($table));
return DB::fetchObject("SELECT $fields FROM $table", get_called_class(), []);
}
}

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.05975s using 14 queries.