We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 79e3acf0 authored by mattl's avatar mattl

Moved multiGet into Managed_DataObject

parent b3e61ce7
......@@ -61,6 +61,20 @@ abstract class Managed_DataObject extends Memcached_DataObject
return parent::pkeyGetClass(get_called_class(), $kv);
}
/**
* Get multiple items from the database by key
*
* @param string $keyCol name of column for key
* @param array $keyVals key values to fetch
* @param boolean $skipNulls return only non-null results?
*
* @return array Array of objects, in order
*/
static function multiGet($keyCol, array $keyVals, $skipNulls=true)
{
return parent::multiGetClass(get_called_class(), $keyCol, $keyVals, $skipNulls);
}
/**
* Get multiple items from the database by key
*
......
......@@ -74,7 +74,7 @@ class Memcached_DataObject extends Safe_DataObject
*
* @return array Array of objects, in order
*/
function multiGet($cls, $keyCol, array $keyVals, $skipNulls=true)
static function multiGetClass($cls, $keyCol, array $keyVals, $skipNulls=true)
{
$result = self::pivotGetClass($cls, $keyCol, $keyVals);
......
......@@ -130,11 +130,6 @@ class Notice extends Managed_DataObject
return $def;
}
function multiGet($kc, $kvs, $skipNulls=true)
{
return Memcached_DataObject::multiGet('Notice', $kc, $kvs, $skipNulls);
}
/* Notice types */
const LOCAL_PUBLIC = 1;
......@@ -831,7 +826,7 @@ class Notice extends Managed_DataObject
$ids[] = $f2p->file_id;
}
$files = Memcached_DataObject::multiGet('File', 'id', $ids);
$files = File::multiGet('id', $ids);
$this->_attachments = $files->fetchAll();
......
......@@ -78,11 +78,6 @@ class Profile extends Managed_DataObject
return $def;
}
function multiGet($keyCol, $keyVals, $skipNulls=true)
{
return parent::multiGet('Profile', $keyCol, $keyVals, $skipNulls);
}
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
......
......@@ -30,11 +30,6 @@ class User_group extends Managed_DataObject
public $join_policy; // tinyint
public $force_scope; // tinyint
function multiGet($keyCol, $keyVals, $skipNulls=true)
{
return parent::multiGet('User_group', $keyCol, $keyVals, $skipNulls);
}
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
......
......@@ -254,7 +254,7 @@ class ActivitySpamPlugin extends Plugin
foreach ($notices as $notice) {
$ids[] = $notice->id;
}
Memcached_DataObject::multiGet('Spam_score', 'notice_id', $ids);
Spam_score::multiGet('notice_id', $ids);
}
return true;
}
......
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