* @return Notice_to_status object found, or null for no hits
*
*/
-
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Notice_to_status', $k, $v);
*
* @return array array of column definitions
*/
-
function table()
{
return array('notice_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('notice_id' => 'K', 'status_id' => 'U');
*
* @return array magic three-false array that stops auto-incrementing.
*/
-
function sequenceKey()
{
return array(false, false, false);
/**
* Save a mapping between a notice and a status
+ * Warning: status_id values may not fit in 32-bit integers.
*
* @param integer $notice_id ID of the notice in StatusNet
* @param integer $status_id ID of the status in Twitter
*
* @return Notice_to_status new object for this value
*/
-
static function saveNew($notice_id, $status_id)
{
+ if (empty($notice_id)) {
+ throw new Exception("Invalid notice_id $notice_id");
+ }
$n2s = Notice_to_status::staticGet('notice_id', $notice_id);
if (!empty($n2s)) {
return $n2s;
}
+ if (empty($status_id)) {
+ throw new Exception("Invalid status_id $status_id");
+ }
$n2s = Notice_to_status::staticGet('status_id', $status_id);
if (!empty($n2s)) {
return $n2s;
}
+ common_debug("Mapping notice {$notice_id} to Twitter status {$status_id}");
+
$n2s = new Notice_to_status();
$n2s->notice_id = $notice_id;