From 36d878ac00f4df0a4ff54e2ea8355b323f0a87f3 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Sat, 12 Jan 2019 15:52:55 +0100 Subject: add timeline class and event class --- app/class/dbitem.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/class/dbitem.php (limited to 'app/class/dbitem.php') diff --git a/app/class/dbitem.php b/app/class/dbitem.php new file mode 100644 index 0000000..ff41d6f --- /dev/null +++ b/app/class/dbitem.php @@ -0,0 +1,19 @@ + $value) { + $method = 'set' . $key; + + if (method_exists($this, $method)) { + $this->$method($value); + } + } + + } +} + + +?> \ No newline at end of file -- cgit v1.2.3 From eb30a63c819ca50ebbc896eb293a0745dcd043be Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Sat, 12 Jan 2019 19:49:41 +0100 Subject: timeline message working --- app/class/dbitem.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'app/class/dbitem.php') diff --git a/app/class/dbitem.php b/app/class/dbitem.php index ff41d6f..2035316 100644 --- a/app/class/dbitem.php +++ b/app/class/dbitem.php @@ -2,7 +2,7 @@ class Dbitem { - public function hydrate(array $datas) + public function hydrate($datas) { foreach ($datas as $key => $value) { $method = 'set' . $key; @@ -13,6 +13,19 @@ class Dbitem } } + + public function dry() + { + $array = []; + foreach (get_object_vars($this) as $var => $value) { + if (in_array($var, $this::VAR_DATE)) { + $array[$var] = $this->$var('string'); + } else { + $array[$var] = $this->$var(); + } + } + return $array; + } } -- cgit v1.2.3