X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile_prefs.php;h=bc7c400b890a2c8d3775b359256d0fd88c61a4e3;hb=cb8bf360c42ca8fce44fac62316d6d71d66d912e;hp=27034390f848d4293ff35f701b95d2ac2ef57a77;hpb=c214aa5149df0e0804c362021c209f78b5ee6483;p=quix0rs-gnu-social.git diff --git a/classes/Profile_prefs.php b/classes/Profile_prefs.php index 27034390f8..bc7c400b89 100644 --- a/classes/Profile_prefs.php +++ b/classes/Profile_prefs.php @@ -62,11 +62,11 @@ class Profile_prefs extends Managed_DataObject { if (empty($topic)) { $prefs = new Profile_prefs(); - $prefs->profile_id = $profile->id; + $prefs->profile_id = $profile->getID(); $prefs->namespace = $namespace; $prefs->find(); } else { - $prefs = self::pivotGet('profile_id', $profile->id, array('namespace'=>$namespace, 'topic'=>$topic)); + $prefs = self::pivotGet('profile_id', $profile->getID(), array('namespace'=>$namespace, 'topic'=>$topic)); } if (empty($prefs->N)) { @@ -85,31 +85,25 @@ class Profile_prefs extends Managed_DataObject static function getAll(Profile $profile) { try { - $prefs = self::listFind('profile_id', $profile->id); + $prefs = self::listFind('profile_id', array($profile->getID())); } catch (NoResultException $e) { return array(); } $list = array(); - while ($entry = $prefs->fetch()) { - if (!isset($list[$entry->namespace])) { - $list[$entry->namespace] = array(); + while ($prefs->fetch()) { + if (!isset($list[$prefs->namespace])) { + $list[$prefs->namespace] = array(); } - $list[$entry->namespace][$entry->topic] = $entry->data; + $list[$prefs->namespace][$prefs->topic] = $prefs->data; } return $list; } static function getTopic(Profile $profile, $namespace, $topic) { - $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; + return Profile_prefs::getByPK(array('profile_id' => $profile->getID(), + 'namespace' => $namespace, + 'topic' => $topic)); } static function getData(Profile $profile, $namespace, $topic, $def=null) { @@ -164,7 +158,7 @@ class Profile_prefs extends Managed_DataObject } $pref = new Profile_prefs(); - $pref->profile_id = $profile->id; + $pref->profile_id = $profile->getID(); $pref->namespace = $namespace; $pref->topic = $topic; $pref->data = $data;