From 0d154365a23678c138cadad31f746aa27ac3f96a Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 14 Jan 2018 23:07:34 +0100 Subject: models: return null on empty result --- includes/model/ShiftEntry_model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'includes/model/ShiftEntry_model.php') diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index 02eace1e..ebf600f3 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -134,11 +134,13 @@ function ShiftEntry_update($shift_entry) * Get a shift entry. * * @param int $shift_entry_id - * @return array + * @return array|null */ function ShiftEntry($shift_entry_id) { - return DB::selectOne('SELECT * FROM `ShiftEntry` WHERE `id` = ?', [$shift_entry_id]); + $shiftEntry = DB::selectOne('SELECT * FROM `ShiftEntry` WHERE `id` = ?', [$shift_entry_id]); + + return empty($shiftEntry) ? null : $shiftEntry; } /** -- cgit v1.2.3-54-g00ecf