From 4e69c23d28a3125bca7ab8fdf31eb956dd9e2f2a Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Thu, 2 Oct 2014 14:59:36 +0000
Subject: [PATCH] Add centralized object model registry

---
 include/class.thread.php | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/class.thread.php b/include/class.thread.php
index 7c5635bd4..598398860 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -65,8 +65,17 @@ class Thread {
         return $this->ht['object_type'];
     }
 
-    function getObjectId() {
-        return $this->ht['object_id'];
+    function getObject() {
+
+        if (!$this->_object)
+            $this->_object = ObjectModel::lookup(
+                    $this->getObjectId(), $this->getObjectType());
+
+        return $this->_object;
+    }
+
+    function getNumAttachments() {
+        return $this->ht['attachments'];
     }
 
     function getNumEntries() {
-- 
GitLab