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/ShiftEntry_model.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'includes/model/ShiftEntry_model.php') diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index bca63774..563a611f 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -125,17 +125,16 @@ function ShiftEntry_update($shift_entry) * Get a shift entry. * * @param int $shift_entry_id - * @return array|false|null + * @return array|null */ function ShiftEntry($shift_entry_id) { $shift_entry = DB::select('SELECT * FROM `ShiftEntry` WHERE `id` = ?', [$shift_entry_id]); - if (DB::getStm()->errorCode() != '00000') { - return false; - } + if (empty($shift_entry)) { return null; } + return $shift_entry[0]; } @@ -209,7 +208,7 @@ function ShiftEntries_finished_by_user($user) */ function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id) { - $result = DB::select(' + return DB::select(' SELECT * FROM `ShiftEntry` WHERE `SID` = ? @@ -220,10 +219,6 @@ function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id) $angeltype_id, ] ); - if (DB::getStm()->errorCode() != '00000') { - engelsystem_error('Unable to load shift entries.'); - } - return $result; } /** -- cgit v1.2.3-54-g00ecf