From 5ef66b872268dbdaf679e791af76e0d86af59abb Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 1 Apr 2014 15:22:10 -0500
Subject: [PATCH] orm: Fix magic lookup of one-to-one relations

---
 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 8a06eb6ee..46a6d6b83 100644
--- a/include/class.orm.php
+++ b/include/class.orm.php
@@ -46,7 +46,8 @@ class VerySimpleModel {
             // TODO: Support instrumented lists and such
             $j = static::$meta['joins'][$field];
             $class = $j['fkey'][0];
-            $v = $this->ht[$field] = $class::lookup($this->ht[$j['local']]);
+            $v = $this->ht[$field] = $class::lookup(
+                array($j['fkey'][1] => $this->ht[$j['local']]));
             return $v;
         }
         throw new OrmException(sprintf('%s: %s: Field not defined',
-- 
GitLab