From 3000adb33d5b8edbf145404e9aa5881f2de20768 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 6 Oct 2013 20:03:56 +0200 Subject: [PATCH] pkeyGet unfortunately returns null (should throw NoResultException) on empty result --- classes/Profile_prefs.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/Profile_prefs.php b/classes/Profile_prefs.php index d7da8813e3..7ad6233c55 100644 --- a/classes/Profile_prefs.php +++ b/classes/Profile_prefs.php @@ -101,8 +101,12 @@ class Profile_prefs extends Managed_DataObject } static function getTopic(Profile $profile, $namespace, $topic) { - $pref = self::pkeyGet(array('profile_id'=>$profile->id, 'namespace'=>$namespace, 'topic'=>$topic)); - if (is_null($pref)) { + $pref = new Profile_prefs; + $pref->profile_id = $profile->id; + $pref->namespace = $namespace; + $pref->topic = $topic; + + if (!$pref->find(true)) { throw new NoResultException($pref); } return $pref;