From a0af8d4624be9ca8579817d291036a6727aeb574 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 28 Jul 2017 19:15:52 +0200 Subject: further switching to db exceptions instead of return false --- includes/model/ShiftTypes_model.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'includes/model/ShiftTypes_model.php') diff --git a/includes/model/ShiftTypes_model.php b/includes/model/ShiftTypes_model.php index d6efe117..05c1a949 100644 --- a/includes/model/ShiftTypes_model.php +++ b/includes/model/ShiftTypes_model.php @@ -71,27 +71,20 @@ function ShiftType_create($name, $angeltype_id, $description) function ShiftType($shifttype_id) { $shifttype = DB::select('SELECT * FROM `ShiftTypes` WHERE `id`=?', [$shifttype_id]); - if (DB::getStm()->errorCode() != '00000') { - engelsystem_error('Unable to load shift type.'); - } + if (empty($shifttype)) { return null; } + return array_shift($shifttype); } /** * Get all shift types. * - * @return array|false + * @return array */ function ShiftTypes() { - $result = DB::select('SELECT * FROM `ShiftTypes` ORDER BY `name`'); - - if (DB::getStm()->errorCode() != '00000') { - return false; - } - - return $result; + return DB::select('SELECT * FROM `ShiftTypes` ORDER BY `name`'); } -- cgit v1.2.3-70-g09d2