From 8ccc4ac00c974ba3659762e6c67f75ed82020e37 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Tue, 14 Apr 2020 16:36:45 +0200 Subject: finish flashmessages implementation + clean css --- app/class/Item.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/class/Item.php') diff --git a/app/class/Item.php b/app/class/Item.php index 8bd62d1..10d35d7 100644 --- a/app/class/Item.php +++ b/app/class/Item.php @@ -12,13 +12,21 @@ abstract class Item public function hydrate($datas = []) { + $error = 0; foreach ($datas as $key => $value) { $method = 'set' . $key; if (method_exists($this, $method)) { - $this->$method($value); + if($this->$method($value) === false) { + $error ++; + } } - } + } + if ($error > 0) { + return false; + } else { + return true; + } } -- cgit v1.2.3