From aba9a07a3c73ef6a2170b31709e3c45d786facd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 26 Nov 2011 17:49:35 +0100 Subject: [PATCH] Changing CacheBuilder to return the list rather than an array Furthermore if the parameter is not passend we will select the first room automatically --- file/lib/page/ChatPage.class.php | 9 +++------ .../system/cache/builder/ChatRoomCacheBuilder.class.php | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 19abe1f..331e538 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -36,12 +36,9 @@ public function assignVariables() { public function readData() { parent::readData(); $this->rooms = chat\room\ChatRoom::getCache(); - if (isset($this->rooms[$this->roomID])) { - $this->room = $this->rooms[$this->roomID]; - } - else { - throw new \wcf\system\exception\IllegalLinkException(); - } + $this->room = $this->rooms->search($this->roomID); + + if (!$this->room) throw new \wcf\system\exception\IllegalLinkException(); } /** diff --git a/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php b/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php index c645d67..9fca599 100644 --- a/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php +++ b/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php @@ -20,8 +20,7 @@ public function getData(array $cacheResource) { $roomList->sqlOrderBy = "chat_room.position"; $roomList->sqlLimit = 0; $roomList->readObjects(); - $rooms = $roomList->getObjects(); - return $rooms; + return $roomList; } }