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/Room_model.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'includes/model/Room_model.php') diff --git a/includes/model/Room_model.php b/includes/model/Room_model.php index 08e0f7bf..8425e5ad 100644 --- a/includes/model/Room_model.php +++ b/includes/model/Room_model.php @@ -58,17 +58,11 @@ function Room_create($name, $from_frab, $public, $number = null) */ function Room($room_id, $onlyVisible = true) { - $room_source = DB::select(' + return DB::selectOne(' SELECT * FROM `Room` WHERE `RID` = ? ' . ($onlyVisible ? 'AND `show` = \'Y\'' : ''), [$room_id] ); - - if (empty($room_source)) { - return null; - } - - return array_shift($room_source); } -- cgit v1.2.3-54-g00ecf