From 9ec4ac59a21786910a38bc402ecb29edb02c2070 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Sat, 18 Oct 2014 08:22:59 -0500
Subject: [PATCH] orm: oops: Fix crash compiling delete model stmt

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

diff --git a/include/class.orm.php b/include/class.orm.php
index 883605808..664b506f1 100644
--- a/include/class.orm.php
+++ b/include/class.orm.php
@@ -1682,7 +1682,8 @@ class MySqlCompiler extends SqlCompiler {
     function compileDelete($model) {
         $table = $model::$meta['table'];
 
-        $where = ' WHERE '.implode(' AND ', $this->compileConstraints($model->pk));
+        $where = ' WHERE '.implode(' AND ',
+            $this->compileConstraints(array(new Q($model->pk)), $model));
         $sql = 'DELETE FROM '.$this->quote($table).$where.' LIMIT 1';
         return new MySqlExecutor($sql, $this->params);
     }
-- 
GitLab