diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-01-14 23:07:34 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-01-14 23:07:34 +0100 |
commit | 0d154365a23678c138cadad31f746aa27ac3f96a (patch) | |
tree | 059a22951a20bd85e2acfbda68fee8899bed0fe0 /includes/model/ShiftTypes_model.php | |
parent | 646ffc19107999a1cdcd1c897fbb6d28d520bb13 (diff) |
models: return null on empty result
Diffstat (limited to 'includes/model/ShiftTypes_model.php')
-rw-r--r-- | includes/model/ShiftTypes_model.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/model/ShiftTypes_model.php b/includes/model/ShiftTypes_model.php index 0e8ef3a4..599810be 100644 --- a/includes/model/ShiftTypes_model.php +++ b/includes/model/ShiftTypes_model.php @@ -66,11 +66,13 @@ function ShiftType_create($name, $angeltype_id, $description) * Get a shift type by id. * * @param int $shifttype_id - * @return array + * @return array|null */ function ShiftType($shifttype_id) { - return DB::selectOne('SELECT * FROM `ShiftTypes` WHERE `id`=?', [$shifttype_id]); + $shiftType = DB::selectOne('SELECT * FROM `ShiftTypes` WHERE `id`=?', [$shifttype_id]); + + return empty($shiftType) ? null : $shiftType; } /** |