Moved multiGet into Managed_DataObject
This commit is contained in:
parent
b3e61ce7d0
commit
79e3acf0f0
@ -61,6 +61,20 @@ abstract class Managed_DataObject extends Memcached_DataObject
|
|||||||
return parent::pkeyGetClass(get_called_class(), $kv);
|
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
|
* 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
|
* @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);
|
$result = self::pivotGetClass($cls, $keyCol, $keyVals);
|
||||||
|
|
||||||
|
@ -131,11 +131,6 @@ class Notice extends Managed_DataObject
|
|||||||
return $def;
|
return $def;
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiGet($kc, $kvs, $skipNulls=true)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::multiGet('Notice', $kc, $kvs, $skipNulls);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Notice types */
|
/* Notice types */
|
||||||
const LOCAL_PUBLIC = 1;
|
const LOCAL_PUBLIC = 1;
|
||||||
const REMOTE = 0;
|
const REMOTE = 0;
|
||||||
@ -831,7 +826,7 @@ class Notice extends Managed_DataObject
|
|||||||
$ids[] = $f2p->file_id;
|
$ids[] = $f2p->file_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = Memcached_DataObject::multiGet('File', 'id', $ids);
|
$files = File::multiGet('id', $ids);
|
||||||
|
|
||||||
$this->_attachments = $files->fetchAll();
|
$this->_attachments = $files->fetchAll();
|
||||||
|
|
||||||
|
@ -79,11 +79,6 @@ class Profile extends Managed_DataObject
|
|||||||
return $def;
|
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 */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
|
@ -30,11 +30,6 @@ class User_group extends Managed_DataObject
|
|||||||
public $join_policy; // tinyint
|
public $join_policy; // tinyint
|
||||||
public $force_scope; // 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 */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ class ActivitySpamPlugin extends Plugin
|
|||||||
foreach ($notices as $notice) {
|
foreach ($notices as $notice) {
|
||||||
$ids[] = $notice->id;
|
$ids[] = $notice->id;
|
||||||
}
|
}
|
||||||
Memcached_DataObject::multiGet('Spam_score', 'notice_id', $ids);
|
Spam_score::multiGet('notice_id', $ids);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user