From 274df21ba2815dd495ba1ffc13d36a8f96f1e8fa Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 28 May 2015 11:49:28 -0500
Subject: [PATCH] orm: Drop model cache on InconsistentModelException

---
 include/class.orm.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/class.orm.php b/include/class.orm.php
index d1aa0c538..ef3e2cea4 100644
--- a/include/class.orm.php
+++ b/include/class.orm.php
@@ -19,7 +19,13 @@
 class OrmException extends Exception {}
 class OrmConfigurationException extends Exception {}
 // Database fields/tables do not match codebase
-class InconsistentModelException extends OrmException {}
+class InconsistentModelException extends OrmException {
+    function __construct() {
+        // Drop the model cache (just incase)
+        ModelMeta::flushModelCache();
+        call_user_func_array(array('parent', '__construct'), func_get_args());
+    }
+}
 
 /**
  * Meta information about a model including edges (relationships), table
-- 
GitLab