}
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Avatar', $kv);
- }
-
/**
* Where should the avatar go for this user?
*/
return $result;
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Config', $kv);
- }
-
static function save($section, $setting, $value)
{
$result = null;
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)
{
$stream = new FaveNoticeStream($user_id, $own);
}
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('File_to_post', $kv);
- }
-
function delete()
{
$f = File::getKV('id', $this->file_id);
);
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Group_block', $kv);
- }
-
static function isBlocked($group, $profile)
{
$block = Group_block::pkeyGet(array('group_id' => $group->id,
),
);
}
-
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Group_inbox', $kv);
- }
}
public $group_id;
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 */
###END_AUTOCODE
);
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Group_member', $kv);
- }
-
/**
* Method to add a user to a group.
* In most cases, you should call Profile->joinGroup() instead.
*/
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
* @param mixed $v key field value, or leave out for primary key lookup
* @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)) {
$v = $k;
$keys = self::pkeyCols($cls);
if (count($keys) > 1) {
- // FIXME: maybe call pkeyGet() ourselves?
- throw new Exception('Use pkeyGet() for compound primary keys');
+ // FIXME: maybe call pkeyGetClass() ourselves?
+ throw new Exception('Use pkeyGetClass() for compound primary keys');
}
$k = $keys[0];
}
/**
* @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);
if ($i !== false) { // false == cache miss
'update',
'find');
$ignoreStatic = array('getKV',
+ 'getClassKV',
'pkeyGet',
+ 'pkeyGetClass',
'cachedQuery');
$here = get_class($this); // if we get confused
$bt = debug_backtrace();
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)
{
throw new Exception('Notice_inbox no longer used; use Inbox');
}
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Notice_tag', $kv);
- }
-
static function url($tag)
{
if (common_config('singleuser', 'enabled')) {
{
// XXX: not really a pkey, but should work
- $notice = Memcached_DataObject::pkeyGet('Notice',
- array('profile_id' => $this->id,
- 'repeat_of' => $notice_id));
+ $notice = Notice::pkeyGet(array('profile_id' => $this->id,
+ 'repeat_of' => $notice_id));
return !empty($notice);
}
function get($blocker, $blocked)
{
- return Memcached_DataObject::pkeyGet('Profile_block',
- array('blocker' => $blocker,
- 'blocked' => $blocked));
+ return Profile_block::pkeyGet(array('blocker' => $blocker,
+ 'blocked' => $blocked));
}
}
);
}
- /**
- * 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
*
);
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Profile_role', $kv);
- }
-
const OWNER = 'owner';
const MODERATOR = 'moderator';
const ADMINISTRATOR = 'administrator';
);
}
- function pkeyGet($kv) {
- return Memcached_DataObject::pkeyGet('Profile_tag', $kv);
- }
-
function links()
{
return array('tagger,tag' => 'profile_list:tagger,tag');
);
}
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Profile_tag_subscription', $kv);
- }
-
static function add($peopletag, $profile)
{
if ($peopletag->private) {
),
);
}
-
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('Reply',$kv);
- }
/**
* Wrapper for record insertion to update related caches
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);
}
/**
);
}
- /* 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
*
public $subscribed;
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 */
###END_AUTOCODE
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
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 */
###END_AUTOCODE
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
*
public $response; // tinyint
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
* since the DB_DataObject stuff doesn't understand compound keys
public $created;
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()
{
return array(
public $grant; // 1 = grant, 0 = revoke
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 code above is auto generated do not remove the tag below */
###END_AUTOCODE
- function pkeyGet($kv)
- {
- return Memcached_DataObject::pkeyGet('User_openid_trustroot', $kv);
- }
-
function table()
{
$db = $this->getDatabaseConnection();
public $options; // text; newline(?)-delimited
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.
*/
public $selection; // int -> choice #
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.
*/
public $content; // text -> response text
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.
*/
public $closed; // int (boolean) whether a question is closed
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.
*/
public $profile_id; // int -> question.id
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.
*/
public $created; // created 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.
*/
public $profile_id; // int -> profile.id
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.
*/
return $saved;
}
- public /*static*/ function pkeyGet($v)
- {
- return parent::pkeyGet(__CLASS__, $v);
- }
-
/**
* Get the mirroring setting for a pair of profiles, if existing.
*
public $profile_id; // int -> profile.id
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.
*/
public $created; // 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 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
*
*/
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)) {
return $map;
}
- $map = Memcached_DataObject::staticGet($class, $field, $local_id);
+ $map = Memcached_DataObject::getClassKV($class, $field, $local_id);
if (!empty($map)) {
return $map;