Makes use of DatabaseObjectList::$decoratorClassName
authorMatthias Schmidt <gravatronics@live.com>
Fri, 28 Dec 2012 12:32:06 +0000 (13:32 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 28 Dec 2012 12:32:06 +0000 (13:32 +0100)
files/lib/data/conversation/FeedConversationList.class.php
files/lib/data/conversation/UserConversationList.class.php
files/lib/data/conversation/message/SearchResultConversationMessageList.class.php
files/lib/data/conversation/message/ViewableConversationMessageList.class.php

index 82f5462e13e3f3a2b43216bce64491fce5057cd5..86b40ba0a5559111b0957e45e049a8e803d97f68 100644 (file)
@@ -14,8 +14,7 @@ use wcf\system\WCF;
  */
 class FeedConversationList extends ConversationList {
        /**
-        * decorator class name
-        * @var string
+        * @see wcf\data\DatabaseObjectList::$decoratorClassName
         */
        public $decoratorClassName = 'wcf\data\conversation\FeedConversation';
        
@@ -45,12 +44,10 @@ class FeedConversationList extends ConversationList {
         * @see wcf\data\DatabaseObjectList::readObjects()
         */
        public function readObjects() {
-               if ($this->objectIDs === null) $this->readObjectIDs();
-               parent::readObjects();
-               
-               foreach ($this->objects as &$conversation) {
-                       $conversation = new $this->decoratorClassName($conversation);
+               if ($this->objectIDs === null) {
+                       $this->readObjectIDs();
                }
-               unset($conversation);
+               
+               parent::readObjects();
        }
 }
index ecb74e56560832130528eabbc7e756d94e3c18a9..624649e50b08362c98edb10da964cb43c02d41f3 100644 (file)
@@ -35,8 +35,7 @@ class UserConversationList extends ConversationList {
        public $labelList = null;
        
        /**
-        * decorator class name
-        * @var string
+        * @see wcf\data\DatabaseObjectList::$decoratorClassName
         */
        public $decoratorClassName = 'wcf\data\conversation\ViewableConversation';
        
@@ -142,21 +141,21 @@ class UserConversationList extends ConversationList {
         * @see wcf\data\DatabaseObjectList::readObjects()
         */
        public function readObjects() {
-               if ($this->objectIDs === null) $this->readObjectIDs();
+               if ($this->objectIDs === null) {
+                       $this->readObjectIDs();
+               }
+               
                parent::readObjects();
                
                $labels = $this->loadLabelAssignments();
                
-               foreach ($this->objects as $conversationID => &$conversation) {
-                       $conversation = new $this->decoratorClassName($conversation);
-                       
+               foreach ($this->objects as $conversationID => $conversation) {
                        if (isset($labels[$conversationID])) {
                                foreach ($labels[$conversationID] as $label) {
                                        $conversation->assignLabel($label);
                                }
                        }
                }
-               unset($conversation);
        }
        
        /**
index 4d8d80e446ee6a4adb55f2b3d82a92e6c4e14769..c9749f6e4a59083e8520de13cdb734ee3ad83219 100644 (file)
@@ -13,7 +13,7 @@ namespace wcf\data\conversation\message;
  */
 class SearchResultConversationMessageList extends ViewableConversationMessageList {
        /**
-        * @see wcf\data\conversation\message\ViewableConversationMessageList::$decoratorClassName
+        * @see wcf\data\DatabaseObjectList::$decoratorClassName
         */
        public $decoratorClassName = 'wcf\data\conversation\message\SearchResultConversationMessage';
        
index acc3d7185a0cbb1bf1539bdd02fd1773d32d524b..b134baab708b3e808991ed12b105e3ed7ac8fbe3 100644 (file)
@@ -19,8 +19,7 @@ class ViewableConversationMessageList extends ConversationMessageList {
        public $sqlOrderBy = 'conversation_message.time';
        
        /**
-        * decorator class name
-        * @var string
+        * @see wcf\data\DatabaseObjectList::$decoratorClassName
         */
        public $decoratorClassName = 'wcf\data\conversation\message\ViewableConversationMessage';
        
@@ -61,13 +60,16 @@ class ViewableConversationMessageList extends ConversationMessageList {
         * @see wcf\data\DatabaseObjectList::readObjects()
         */
        public function readObjects() {
-               if ($this->objectIDs === null) $this->readObjectIDs();
+               if ($this->objectIDs === null) {
+                       $this->readObjectIDs();
+               }
+               
                parent::readObjects();
                
-               $messageIDs = array();
                foreach ($this->objects as &$message) {
-                       if ($message->time > $this->maxPostTime) $this->maxPostTime = $message->time;
-                       $message = new $this->decoratorClassName($message);
+                       if ($message->time > $this->maxPostTime) {
+                               $this->maxPostTime = $message->time;
+                       }
                        
                        if ($message->attachments) {
                                $this->attachmentObjectIDs[] = $message->messageID;