*
* @see DB_DataObject
*/
-
class Twitter_synch_status extends Memcached_DataObject
{
public $__table = 'twitter_synch_status'; // table name
* @param string $k Key to use to lookup (usually 'foreign_id' for this class)
* @param mixed $v Value to lookup
*
- * @return User_greeting_count object found, or null for no hits
- *
+ * @return Twitter_synch_status object found, or null for no hits
*/
-
function staticGet($k, $v=null)
{
- return Memcached_DataObject::staticGet('Twitter_synch_status', $k, $v);
+ 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 array array of column definitions
*/
-
function table()
{
return array('foreign_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
*
* @return array list of key field names
*/
-
function keys()
{
return array_keys($this->keyTypes());
* 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here.
*/
-
function keyTypes()
{
return array('foreign_id' => 'K',
*
* @return array magic three-false array that stops auto-incrementing.
*/
-
function sequenceKey()
{
return array(false, false, false);
static function getLastId($foreign_id, $timeline)
{
- $tss = self::staticGet(array('foreign_id' => $foreign_id,
- 'timeline' => $timeline));
+ $tss = self::pkeyGet(array('foreign_id' => $foreign_id,
+ 'timeline' => $timeline));
if (empty($tss)) {
return null;
static function setLastId($foreign_id, $timeline, $last_id)
{
- $tss = self::staticGet(array('foreign_id' => $foreign_id,
- 'timeline' => $timeline));
+ $tss = self::pkeyGet(array('foreign_id' => $foreign_id,
+ 'timeline' => $timeline));
if (empty($tss)) {
-
$tss = new Twitter_synch_status();
$tss->foreign_id = $foreign_id;
$tss->insert();
return true;
-
} else {
-
$orig = clone($tss);
$tss->last_id = $last_id;