Commit 3000adb3 authored by mmn's avatar mmn

pkeyGet unfortunately returns null (should throw NoResultException) on empty result

parent e93c4d62
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment