* down in reverse chronological order, then go back over them from oldest to
* newest and actually save them into our notice table.
*/
-
-class Yammer_notice_stub extends Memcached_DataObject
+class Yammer_notice_stub extends Managed_DataObject
{
public $__table = 'yammer_notice_stub'; // table name
public $id; // int primary_key not_null
/**
* Return schema definition to set this table up in onCheckSchema
*/
- static function schemaDef($field)
+ static function schemaDef()
{
return array(new ColumnDef('id', 'bigint', null,
false, 'PRI'),
*
* @return array array of column definitions
*/
-
function table()
{
return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
- 'json_data' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
+ 'json_data' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL);
}
* '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('id' => 'K');
*
* @return array magic three-false array that stops auto-incrementing.
*/
-
function sequenceKey()
{
return array(false, false, false);
}
+ /**
+ * Decode the stored data structure.
+ *
+ * @return mixed
+ */
+ public function getData()
+ {
+ return json_decode($this->json_data, true);
+ }
+
/**
* Save the native Yammer API representation of a message for the pending
* import. Since they come in in reverse chronological order, we need to
return $stub;
}
-
- /**
- * Save a mapping between a remote Yammer and local imported user.
- *
- * @param integer $user_id ID of the status in StatusNet
- *
- * @return Yammer_notice_stub new object for this value
- */
-
- static function retrieve($orig_id)
- {
- $stub = self::staticGet('id', $orig_id);
- if ($stub) {
- return json_decode($stub->json_data, true);
- } else {
- return false;
- }
- }
}