pkeyGet unfortunately returns null (should throw NoResultException) on empty result
This commit is contained in:
parent
e93c4d6268
commit
3000adb33d
@ -101,8 +101,12 @@ class Profile_prefs extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function getTopic(Profile $profile, $namespace, $topic) {
|
static function getTopic(Profile $profile, $namespace, $topic) {
|
||||||
$pref = self::pkeyGet(array('profile_id'=>$profile->id, 'namespace'=>$namespace, 'topic'=>$topic));
|
$pref = new Profile_prefs;
|
||||||
if (is_null($pref)) {
|
$pref->profile_id = $profile->id;
|
||||||
|
$pref->namespace = $namespace;
|
||||||
|
$pref->topic = $topic;
|
||||||
|
|
||||||
|
if (!$pref->find(true)) {
|
||||||
throw new NoResultException($pref);
|
throw new NoResultException($pref);
|
||||||
}
|
}
|
||||||
return $pref;
|
return $pref;
|
||||||
|
Loading…
Reference in New Issue
Block a user