Commit 6c4c4319 authored by mmn's avatar mmn

Plugins with classes that extend Managed_DataObject get better code reuse

The switch to having a function in Managed_DataObject is now being applied
to plugins which can use this as well.

There are some plugins that still use Memcached_DataObject, but these will
be taken care of later.
parent 1a9a8ea7
......@@ -53,20 +53,6 @@ class Spam_score extends Managed_DataObject
public $score; // float
public $created; // datetime
/**
* Get an instance by key
*
* @param string $k Key to use to lookup (usually 'notice_id' for this class)
* @param mixed $v Value to lookup
*
* @return Spam_score object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Managed_DataObject::staticGet('Spam_score', $k, $v);
}
function saveNew($notice, $result) {
$score = new Spam_score();
......
......@@ -61,11 +61,6 @@ class Blog_entry extends Managed_DataObject
const TYPE = ActivityObject::ARTICLE;
function staticGet($k, $v=null)
{
return Managed_DataObject::staticGet('Blog_entry', $k, $v);
}
static function schemaDef()
{
return array(
......
......@@ -37,21 +37,6 @@ class Email_reminder extends Managed_DataObject
public $created; // timestamp
public $modified; // timestamp
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup
* @param mixed $v Value to lookup
*
* @return QnA_Answer object found, or null for no hits
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('email_reminder', $k, $v);
}
/**
* Do we need to send a reminder?
*
......
......@@ -63,20 +63,6 @@ class Happening extends Managed_DataObject
public $description; // text
public $created; // datetime
/**
* Get an instance by key
*
* @param string $k Key to use to lookup (usually 'id' for this class)
* @param mixed $v Value to lookup
*
* @return Happening object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Happening', $k, $v);
}
/**
* The One True Thingy that must be defined and declared.
*/
......
......@@ -56,19 +56,6 @@ class RSVP extends Managed_DataObject
public $response; // tinyint
public $created; // datetime
/**
* Get an instance by key
*
* @param string $k Key to use to lookup (usually 'id' for this class)
* @param mixed $v Value to lookup
*
* @return RSVP object found, or null for no hits
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('RSVP', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -69,22 +69,6 @@ class Profile_detail extends Managed_DataObject
public $created;
public $modified;
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup
* @param mixed $v Value to lookup
*
* @return User_greeting_count object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Profile_detail', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -46,11 +46,6 @@ class Photo extends Managed_DataObject
public $description; // text
public $profile_id; // int
public function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('photo', $k, $v);
}
public function getByNotice($notice)
{
return self::staticGet('uri', $notice->uri);
......
......@@ -43,11 +43,6 @@ class Video extends Managed_DataObject
public $url; // varchar (255)
public $profile_id; // int
public function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Video', $k, $v);
}
public function getByNotice($notice)
{
return self::staticGet('uri', $notice->uri);
......
......@@ -55,20 +55,6 @@ class ModLog extends Managed_DataObject
public $grant; // 1 = grant, 0 = revoke
public $created; // datetime
/**
* Get an instance by key
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return TagSub object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Managed_DataObject::staticGet('ModLog', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -42,11 +42,6 @@ class Ostatus_profile extends Managed_DataObject
public $created;
public $modified;
public /*static*/ function staticGet($k, $v=null)
{
return parent::staticGet(__CLASS__, $k, $v);
}
/**
* Return table definition for Schema setup and DB_DataObject usage.
*
......
......@@ -53,22 +53,6 @@ class User_openid_prefs extends Managed_DataObject
public $created; // datetime
public $modified; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return TagSub object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Managed_DataObject::staticGet('User_openid_prefs', $k, $v);
}
/**
* The One True Thingy that must be defined and declared.
*/
......
......@@ -53,22 +53,6 @@ class Poll extends Managed_DataObject
public $options; // text; newline(?)-delimited
public $created; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return User_greeting_count object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Poll', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -52,22 +52,6 @@ class Poll_response extends Managed_DataObject
public $selection; // int -> choice #
public $created; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return User_greeting_count object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Poll_response', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -50,22 +50,6 @@ class User_poll_prefs extends Managed_DataObject
public $created; // datetime
public $modified; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return User_greeting_count object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('User_poll_prefs', $k, $v);
}
/**
* The One True Thingy that must be defined and declared.
*/
......
......@@ -55,22 +55,6 @@ class QnA_Answer extends Managed_DataObject
public $content; // text -> response text
public $created; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup
* @param mixed $v Value to lookup
*
* @return QnA_Answer object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('QnA_Answer', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -55,22 +55,6 @@ class QnA_Question extends Managed_DataObject
public $closed; // int (boolean) whether a question is closed
public $created; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup
* @param mixed $v Value to lookup
*
* @return QnA_Question object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('QnA_Question', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -55,22 +55,6 @@ class QnA_Vote extends Managed_DataObject
public $profile_id; // int -> question.id
public $created; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup
* @param mixed $v Value to lookup
*
* @return QnA_Vote object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('QnA_Vote', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -61,21 +61,6 @@ class Realtime_channel extends Managed_DataObject
public $created; // created date
public $modified; // modified date
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return Realtime_channel object found, or null for no hits
*/
function staticGet($k, $v=null)
{
return Managed_DataObject::staticGet('Realtime_channel', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -50,22 +50,6 @@ class SearchSub extends Managed_DataObject
public $profile_id; // int -> profile.id
public $created; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return SearchSub object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('SearchSub', $k, $v);
}
/**
* Get an instance by compound key
*
......
......@@ -49,22 +49,6 @@ class TagSub extends Managed_DataObject
public $profile_id; // int -> profile.id
public $created; // datetime
/**
* Get an instance by key
*
* This is a utility method to get a single instance with a given key value.
*
* @param string $k Key to use to lookup (usually 'user_id' for this class)
* @param mixed $v Value to lookup
*
* @return TagSub object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('TagSub', $k, $v);
}
/**
* Get an instance by compound key
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment