forked from GNUsocial/gnu-social
pkeyGet is now static and more similar to getKV
Memcached_DataObject now defines * pkeyGetClass to avoid collision with Managed_DataObject pkeyGet * getClassKV to avoid collision with Managed_DataObject getKV
This commit is contained in:
parent
1710a619a8
commit
861e838add
@ -64,11 +64,6 @@ class Avatar extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Avatar', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Where should the avatar go for this user?
|
* Where should the avatar go for this user?
|
||||||
*/
|
*/
|
||||||
|
@ -133,11 +133,6 @@ class Config extends Managed_DataObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Config', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function save($section, $setting, $value)
|
static function save($section, $setting, $value)
|
||||||
{
|
{
|
||||||
$result = null;
|
$result = null;
|
||||||
|
@ -99,11 +99,6 @@ class Fave extends Managed_DataObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Fave', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0)
|
function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0)
|
||||||
{
|
{
|
||||||
$stream = new FaveNoticeStream($user_id, $own);
|
$stream = new FaveNoticeStream($user_id, $own);
|
||||||
|
@ -84,11 +84,6 @@ class File_to_post extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('File_to_post', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
function delete()
|
function delete()
|
||||||
{
|
{
|
||||||
$f = File::getKV('id', $this->file_id);
|
$f = File::getKV('id', $this->file_id);
|
||||||
|
@ -55,11 +55,6 @@ class Group_block extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Group_block', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function isBlocked($group, $profile)
|
static function isBlocked($group, $profile)
|
||||||
{
|
{
|
||||||
$block = Group_block::pkeyGet(array('group_id' => $group->id,
|
$block = Group_block::pkeyGet(array('group_id' => $group->id,
|
||||||
|
@ -37,9 +37,4 @@ class Group_inbox extends Managed_DataObject
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Group_inbox', $kv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,6 @@ class Group_join_queue extends Managed_DataObject
|
|||||||
public $group_id;
|
public $group_id;
|
||||||
public $created;
|
public $created;
|
||||||
|
|
||||||
/* Pkey get */
|
|
||||||
function pkeyGet($k)
|
|
||||||
{ return Memcached_DataObject::pkeyGet('Group_join_queue',$k); }
|
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
||||||
|
@ -48,11 +48,6 @@ class Group_member extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Group_member', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to add a user to a group.
|
* Method to add a user to a group.
|
||||||
* In most cases, you should call Profile->joinGroup() instead.
|
* In most cases, you should call Profile->joinGroup() instead.
|
||||||
|
@ -41,9 +41,25 @@ abstract class Managed_DataObject extends Memcached_DataObject
|
|||||||
*/
|
*/
|
||||||
static function getKV($k,$v=NULL)
|
static function getKV($k,$v=NULL)
|
||||||
{
|
{
|
||||||
return parent::getKV(get_called_class(),$k,$v);
|
return parent::getClassKV(get_called_class(), $k, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an instance by compound key
|
||||||
|
*
|
||||||
|
* This is a utility method to get a single instance with a given set of
|
||||||
|
* key-value pairs. Usually used for the primary key for a compound key; thus
|
||||||
|
* the name.
|
||||||
|
*
|
||||||
|
* @param array $kv array of key-value mappings
|
||||||
|
*
|
||||||
|
* @return get_called_class() object if found, or null for no hits
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static function pkeyGet($kv)
|
||||||
|
{
|
||||||
|
return parent::pkeyGetClass(get_called_class(), $kv);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set an associative array of table columns
|
* get/set an associative array of table columns
|
||||||
|
@ -30,14 +30,14 @@ class Memcached_DataObject extends Safe_DataObject
|
|||||||
* @param mixed $v key field value, or leave out for primary key lookup
|
* @param mixed $v key field value, or leave out for primary key lookup
|
||||||
* @return mixed Memcached_DataObject subtype or false
|
* @return mixed Memcached_DataObject subtype or false
|
||||||
*/
|
*/
|
||||||
static function getKV($cls, $k, $v=null)
|
static function getClassKV($cls, $k, $v=null)
|
||||||
{
|
{
|
||||||
if (is_null($v)) {
|
if (is_null($v)) {
|
||||||
$v = $k;
|
$v = $k;
|
||||||
$keys = self::pkeyCols($cls);
|
$keys = self::pkeyCols($cls);
|
||||||
if (count($keys) > 1) {
|
if (count($keys) > 1) {
|
||||||
// FIXME: maybe call pkeyGet() ourselves?
|
// FIXME: maybe call pkeyGetClass() ourselves?
|
||||||
throw new Exception('Use pkeyGet() for compound primary keys');
|
throw new Exception('Use pkeyGetClass() for compound primary keys');
|
||||||
}
|
}
|
||||||
$k = $keys[0];
|
$k = $keys[0];
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ class Memcached_DataObject extends Safe_DataObject
|
|||||||
/**
|
/**
|
||||||
* @todo FIXME: Should this return false on lookup fail to match getKV?
|
* @todo FIXME: Should this return false on lookup fail to match getKV?
|
||||||
*/
|
*/
|
||||||
function pkeyGet($cls, $kv)
|
static function pkeyGetClass($cls, $kv)
|
||||||
{
|
{
|
||||||
$i = Memcached_DataObject::multicache($cls, $kv);
|
$i = Memcached_DataObject::multicache($cls, $kv);
|
||||||
if ($i !== false) { // false == cache miss
|
if ($i !== false) { // false == cache miss
|
||||||
@ -681,7 +681,9 @@ class Memcached_DataObject extends Safe_DataObject
|
|||||||
'update',
|
'update',
|
||||||
'find');
|
'find');
|
||||||
$ignoreStatic = array('getKV',
|
$ignoreStatic = array('getKV',
|
||||||
|
'getClassKV',
|
||||||
'pkeyGet',
|
'pkeyGet',
|
||||||
|
'pkeyGetClass',
|
||||||
'cachedQuery');
|
'cachedQuery');
|
||||||
$here = get_class($this); // if we get confused
|
$here = get_class($this); // if we get confused
|
||||||
$bt = debug_backtrace();
|
$bt = debug_backtrace();
|
||||||
|
@ -76,11 +76,6 @@ class Notice_inbox extends Managed_DataObject
|
|||||||
throw new Exception('Notice_inbox no longer used; use Inbox');
|
throw new Exception('Notice_inbox no longer used; use Inbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
function &pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Notice_inbox', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function gc($user_id)
|
static function gc($user_id)
|
||||||
{
|
{
|
||||||
throw new Exception('Notice_inbox no longer used; use Inbox');
|
throw new Exception('Notice_inbox no longer used; use Inbox');
|
||||||
|
@ -68,11 +68,6 @@ class Notice_tag extends Managed_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Notice_tag', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function url($tag)
|
static function url($tag)
|
||||||
{
|
{
|
||||||
if (common_config('singleuser', 'enabled')) {
|
if (common_config('singleuser', 'enabled')) {
|
||||||
|
@ -1242,9 +1242,8 @@ class Profile extends Managed_DataObject
|
|||||||
{
|
{
|
||||||
// XXX: not really a pkey, but should work
|
// XXX: not really a pkey, but should work
|
||||||
|
|
||||||
$notice = Memcached_DataObject::pkeyGet('Notice',
|
$notice = Notice::pkeyGet(array('profile_id' => $this->id,
|
||||||
array('profile_id' => $this->id,
|
'repeat_of' => $notice_id));
|
||||||
'repeat_of' => $notice_id));
|
|
||||||
|
|
||||||
return !empty($notice);
|
return !empty($notice);
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,7 @@ class Profile_block extends Managed_DataObject
|
|||||||
|
|
||||||
function get($blocker, $blocked)
|
function get($blocker, $blocked)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::pkeyGet('Profile_block',
|
return Profile_block::pkeyGet(array('blocker' => $blocker,
|
||||||
array('blocker' => $blocker,
|
'blocked' => $blocked));
|
||||||
'blocked' => $blocked));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,19 +86,6 @@ class Profile_list extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* return a profile_list record, given its tag and tagger.
|
|
||||||
*
|
|
||||||
* @param array $kv ideally array('tag' => $tag, 'tagger' => $tagger)
|
|
||||||
*
|
|
||||||
* @return Profile_list a Profile_list object with the given tag and tagger.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Profile_list', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the tagger of this profile_list object
|
* get the tagger of this profile_list object
|
||||||
*
|
*
|
||||||
|
@ -56,11 +56,6 @@ class Profile_role extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Profile_role', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
const OWNER = 'owner';
|
const OWNER = 'owner';
|
||||||
const MODERATOR = 'moderator';
|
const MODERATOR = 'moderator';
|
||||||
const ADMINISTRATOR = 'administrator';
|
const ADMINISTRATOR = 'administrator';
|
||||||
|
@ -42,10 +42,6 @@ class Profile_tag extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv) {
|
|
||||||
return Memcached_DataObject::pkeyGet('Profile_tag', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
function links()
|
function links()
|
||||||
{
|
{
|
||||||
return array('tagger,tag' => 'profile_list:tagger,tag');
|
return array('tagger,tag' => 'profile_list:tagger,tag');
|
||||||
|
@ -41,11 +41,6 @@ class Profile_tag_subscription extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Profile_tag_subscription', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function add($peopletag, $profile)
|
static function add($peopletag, $profile)
|
||||||
{
|
{
|
||||||
if ($peopletag->private) {
|
if ($peopletag->private) {
|
||||||
|
@ -41,11 +41,6 @@ class Reply extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Reply',$kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for record insertion to update related caches
|
* Wrapper for record insertion to update related caches
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +60,9 @@ class Status_network_tag extends Safe_DataObject
|
|||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pkeyGet($kv)
|
static function pkeyGet($kv)
|
||||||
{
|
{
|
||||||
return Memcached_DataObject::pkeyGet('Status_network_tag', $kv);
|
return Memcached_DataObject::pkeyGetClass('Status_network_tag', $kv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,14 +69,6 @@ class Subscription extends Managed_DataObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the code above is auto generated do not remove the tag below */
|
|
||||||
###END_AUTOCODE
|
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Subscription', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a new subscription
|
* Make a new subscription
|
||||||
*
|
*
|
||||||
|
@ -14,10 +14,6 @@ class Subscription_queue extends Managed_DataObject
|
|||||||
public $subscribed;
|
public $subscribed;
|
||||||
public $created;
|
public $created;
|
||||||
|
|
||||||
/* Pkey get */
|
|
||||||
function pkeyGet($k)
|
|
||||||
{ return Memcached_DataObject::pkeyGet('Subscription_queue',$k); }
|
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
||||||
|
@ -45,11 +45,6 @@ class User_im_prefs extends Managed_DataObject
|
|||||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('User_im_prefs', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
||||||
|
@ -118,18 +118,6 @@ class Fave_tally extends Managed_DataObject
|
|||||||
return array(false, false, false);
|
return array(false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a single object with multiple keys
|
|
||||||
*
|
|
||||||
* @param array $kv Map of key-value pairs
|
|
||||||
*
|
|
||||||
* @return User_flag_profile found object or null
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Fave_tally', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increment a notice's tally
|
* Increment a notice's tally
|
||||||
*
|
*
|
||||||
|
@ -56,19 +56,6 @@ class RSVP extends Managed_DataObject
|
|||||||
public $response; // tinyint
|
public $response; // tinyint
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return Bookmark object found, or null for no hits
|
|
||||||
*/
|
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('RSVP', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the compound profile_id/event_id index to our cache keys
|
* Add the compound profile_id/event_id index to our cache keys
|
||||||
* since the DB_DataObject stuff doesn't understand compound keys
|
* since the DB_DataObject stuff doesn't understand compound keys
|
||||||
|
@ -69,23 +69,6 @@ class Profile_detail extends Managed_DataObject
|
|||||||
public $created;
|
public $created;
|
||||||
public $modified;
|
public $modified;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return Bookmark object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Profile_detail', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function schemaDef()
|
static function schemaDef()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
@ -55,19 +55,6 @@ class ModLog extends Managed_DataObject
|
|||||||
public $grant; // 1 = grant, 0 = revoke
|
public $grant; // 1 = grant, 0 = revoke
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return TagSub object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Managed_DataObject::pkeyGet('ModLog', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -21,11 +21,6 @@ class User_openid_trustroot extends Managed_DataObject
|
|||||||
/* 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
|
||||||
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('User_openid_trustroot', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
function table()
|
function table()
|
||||||
{
|
{
|
||||||
$db = $this->getDatabaseConnection();
|
$db = $this->getDatabaseConnection();
|
||||||
|
@ -53,23 +53,6 @@ class Poll extends Managed_DataObject
|
|||||||
public $options; // text; newline(?)-delimited
|
public $options; // text; newline(?)-delimited
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return Bookmark object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Poll', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -52,23 +52,6 @@ class Poll_response extends Managed_DataObject
|
|||||||
public $selection; // int -> choice #
|
public $selection; // int -> choice #
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return Bookmark object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Poll_response', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -55,23 +55,6 @@ class QnA_Answer extends Managed_DataObject
|
|||||||
public $content; // text -> response text
|
public $content; // text -> response text
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return QA_Answer object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('QnA_Answer', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -55,23 +55,6 @@ class QnA_Question extends Managed_DataObject
|
|||||||
public $closed; // int (boolean) whether a question is closed
|
public $closed; // int (boolean) whether a question is closed
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return Bookmark object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('QnA_Question', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -55,23 +55,6 @@ class QnA_Vote extends Managed_DataObject
|
|||||||
public $profile_id; // int -> question.id
|
public $profile_id; // int -> question.id
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return QnA_Vote object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('QnA_Vote', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -61,18 +61,6 @@ class Realtime_channel extends Managed_DataObject
|
|||||||
public $created; // created date
|
public $created; // created date
|
||||||
public $modified; // modified date
|
public $modified; // modified date
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return Realtime_channel object found, or null for no hits
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Managed_DataObject::pkeyGet('Realtime_channel', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -50,23 +50,6 @@ class SearchSub extends Managed_DataObject
|
|||||||
public $profile_id; // int -> profile.id
|
public $profile_id; // int -> profile.id
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return SearchSub object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('SearchSub', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -204,11 +204,6 @@ class SubMirror extends Managed_DataObject
|
|||||||
return $saved;
|
return $saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public /*static*/ function pkeyGet($v)
|
|
||||||
{
|
|
||||||
return parent::pkeyGet(__CLASS__, $v);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mirroring setting for a pair of profiles, if existing.
|
* Get the mirroring setting for a pair of profiles, if existing.
|
||||||
*
|
*
|
||||||
|
@ -49,23 +49,6 @@ class TagSub extends Managed_DataObject
|
|||||||
public $profile_id; // int -> profile.id
|
public $profile_id; // int -> profile.id
|
||||||
public $created; // datetime
|
public $created; // datetime
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound key
|
|
||||||
*
|
|
||||||
* This is a utility method to get a single instance with a given set of
|
|
||||||
* key-value pairs. Usually used for the primary key for a compound key; thus
|
|
||||||
* the name.
|
|
||||||
*
|
|
||||||
* @param array $kv array of key-value mappings
|
|
||||||
*
|
|
||||||
* @return TagSub object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('TagSub', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The One True Thingy that must be defined and declared.
|
* The One True Thingy that must be defined and declared.
|
||||||
*/
|
*/
|
||||||
|
@ -57,32 +57,6 @@ class Twitter_synch_status extends Managed_DataObject
|
|||||||
public $created; // datetime not_null
|
public $created; // datetime not_null
|
||||||
public $modified; // datetime not_null
|
public $modified; // datetime not_null
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by key
|
|
||||||
*
|
|
||||||
* @param string $k Key to use to lookup (usually 'foreign_id' for this class)
|
|
||||||
* @param mixed $v Value to lookup
|
|
||||||
*
|
|
||||||
* @return Twitter_synch_status object found, or null for no hits
|
|
||||||
*/
|
|
||||||
static function staticGet($k, $v=null)
|
|
||||||
{
|
|
||||||
throw new Exception("Use pkeyGet() for this class.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an instance by compound primary key
|
|
||||||
*
|
|
||||||
* @param array $kv key-value pair array
|
|
||||||
*
|
|
||||||
* @return Twitter_synch_status object found, or null for no hits
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('Twitter_synch_status', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return table definition for DB_DataObject
|
* return table definition for DB_DataObject
|
||||||
*
|
*
|
||||||
|
@ -108,18 +108,6 @@ class User_flag_profile extends Managed_DataObject
|
|||||||
return array(false, false, false);
|
return array(false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a single object with multiple keys
|
|
||||||
*
|
|
||||||
* @param array $kv Map of key-value pairs
|
|
||||||
*
|
|
||||||
* @return User_flag_profile found object or null
|
|
||||||
*/
|
|
||||||
function pkeyGet($kv)
|
|
||||||
{
|
|
||||||
return Memcached_DataObject::pkeyGet('User_flag_profile', $kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a flag exists for given profile and user
|
* Check if a flag exists for given profile and user
|
||||||
*
|
*
|
||||||
|
@ -133,13 +133,13 @@ class Yammer_common extends Managed_DataObject
|
|||||||
*/
|
*/
|
||||||
protected static function doRecord($class, $field, $orig_id, $local_id)
|
protected static function doRecord($class, $field, $orig_id, $local_id)
|
||||||
{
|
{
|
||||||
$map = Memcached_DataObject::staticGet($class, 'id', $orig_id);
|
$map = Memcached_DataObject::getClassKV($class, 'id', $orig_id);
|
||||||
|
|
||||||
if (!empty($map)) {
|
if (!empty($map)) {
|
||||||
return $map;
|
return $map;
|
||||||
}
|
}
|
||||||
|
|
||||||
$map = Memcached_DataObject::staticGet($class, $field, $local_id);
|
$map = Memcached_DataObject::getClassKV($class, $field, $local_id);
|
||||||
|
|
||||||
if (!empty($map)) {
|
if (!empty($map)) {
|
||||||
return $map;
|
return $map;
|
||||||
|
Loading…
Reference in New Issue
Block a user