Add getObject() to EditHistoryEntry.class.php
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 2 Jul 2014 15:54:24 +0000 (17:54 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jul 2014 19:58:59 +0000 (21:58 +0200)
wcfsetup/install/files/lib/data/edit/history/entry/EditHistoryEntry.class.php

index d4d59ed8f922bad080d4d140c9ed32e46df64176..df01ccf4bd4952fd51e5b6a2d9ab02cb1be9c0c6 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\edit\history\entry;
+use wcf\data\object\type\ObjectTypeCache;
 use wcf\data\DatabaseObject;
 
 /**
@@ -23,6 +24,11 @@ class EditHistoryEntry extends DatabaseObject {
         */
        protected static $databaseTableIndexName = 'entryID';
        
+       /**
+        * @see \wcf\data\edit\history\entry\EntryHistoryEntry::getObject()
+        */
+       protected $object = null;
+       
        /**
         * Returns the message text of the history entry.
         * 
@@ -31,4 +37,20 @@ class EditHistoryEntry extends DatabaseObject {
        public function getMessage() {
                return $this->message;
        }
+       
+       /**
+        * Returns the corresponding IHistorySavingObject
+        * 
+        * @return      \wcf\system\edit\IHistorySavingObject
+        */
+       public function getObject() {
+               if ($this->object === null) {
+                       $objectType = ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID);
+                       $processor = $objectType->getProcessor();
+                       
+                       $this->object = $processor->getObjectByID($this->objectID);
+               }
+               
+               return $this->object;
+       }
 }