Modernize Profile_prefs to use Managed_DataObject functions
This commit is contained in:
parent
d1afc78124
commit
f9698598c6
@ -62,11 +62,11 @@ class Profile_prefs extends Managed_DataObject
|
|||||||
{
|
{
|
||||||
if (empty($topic)) {
|
if (empty($topic)) {
|
||||||
$prefs = new Profile_prefs();
|
$prefs = new Profile_prefs();
|
||||||
$prefs->profile_id = $profile->id;
|
$prefs->profile_id = $profile->getID();
|
||||||
$prefs->namespace = $namespace;
|
$prefs->namespace = $namespace;
|
||||||
$prefs->find();
|
$prefs->find();
|
||||||
} else {
|
} 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)) {
|
if (empty($prefs->N)) {
|
||||||
@ -85,7 +85,7 @@ class Profile_prefs extends Managed_DataObject
|
|||||||
static function getAll(Profile $profile)
|
static function getAll(Profile $profile)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$prefs = self::listFind('profile_id', $profile->id);
|
$prefs = self::listFind('profile_id', $profile->getID());
|
||||||
} catch (NoResultException $e) {
|
} catch (NoResultException $e) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
@ -101,15 +101,9 @@ class Profile_prefs extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function getTopic(Profile $profile, $namespace, $topic) {
|
static function getTopic(Profile $profile, $namespace, $topic) {
|
||||||
$pref = new Profile_prefs;
|
return Profile_prefs::getByPK(array('profile_id' => $profile->getID(),
|
||||||
$pref->profile_id = $profile->id;
|
'namespace' => $namespace,
|
||||||
$pref->namespace = $namespace;
|
'topic' => $topic));
|
||||||
$pref->topic = $topic;
|
|
||||||
|
|
||||||
if (!$pref->find(true)) {
|
|
||||||
throw new NoResultException($pref);
|
|
||||||
}
|
|
||||||
return $pref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getData(Profile $profile, $namespace, $topic, $def=null) {
|
static function getData(Profile $profile, $namespace, $topic, $def=null) {
|
||||||
@ -164,7 +158,7 @@ class Profile_prefs extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pref = new Profile_prefs();
|
$pref = new Profile_prefs();
|
||||||
$pref->profile_id = $profile->id;
|
$pref->profile_id = $profile->getID();
|
||||||
$pref->namespace = $namespace;
|
$pref->namespace = $namespace;
|
||||||
$pref->topic = $topic;
|
$pref->topic = $topic;
|
||||||
$pref->data = $data;
|
$pref->data = $data;
|
||||||
|
Loading…
Reference in New Issue
Block a user