From f82e5456d22af7e39a22a9a64e74072cf01e0a31 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 28 Jul 2017 20:11:09 +0200 Subject: dried code by introducing selectOne for select queries with only one result line expected --- includes/model/ShiftTypes_model.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'includes/model/ShiftTypes_model.php') diff --git a/includes/model/ShiftTypes_model.php b/includes/model/ShiftTypes_model.php index 05c1a949..227df367 100644 --- a/includes/model/ShiftTypes_model.php +++ b/includes/model/ShiftTypes_model.php @@ -70,13 +70,7 @@ function ShiftType_create($name, $angeltype_id, $description) */ function ShiftType($shifttype_id) { - $shifttype = DB::select('SELECT * FROM `ShiftTypes` WHERE `id`=?', [$shifttype_id]); - - if (empty($shifttype)) { - return null; - } - - return array_shift($shifttype); + return DB::selectOne('SELECT * FROM `ShiftTypes` WHERE `id`=?', [$shifttype_id]); } /** -- cgit v1.2.3-70-g09d2