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.
This commit is contained in:
Mikael Nordfeldth 2013-08-12 20:00:01 +02:00
parent 1a9a8ea730
commit 6c4c4319ef
20 changed files with 0 additions and 265 deletions

View File

@ -53,20 +53,6 @@ class Spam_score extends Managed_DataObject
public $score; // float public $score; // float
public $created; // datetime 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) { function saveNew($notice, $result) {
$score = new Spam_score(); $score = new Spam_score();

View File

@ -60,11 +60,6 @@ class Blog_entry extends Managed_DataObject
public $modified; // datetime public $modified; // datetime
const TYPE = ActivityObject::ARTICLE; const TYPE = ActivityObject::ARTICLE;
function staticGet($k, $v=null)
{
return Managed_DataObject::staticGet('Blog_entry', $k, $v);
}
static function schemaDef() static function schemaDef()
{ {

View File

@ -37,21 +37,6 @@ class Email_reminder extends Managed_DataObject
public $created; // timestamp public $created; // timestamp
public $modified; // 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? * Do we need to send a reminder?
* *

View File

@ -63,20 +63,6 @@ class Happening extends Managed_DataObject
public $description; // text public $description; // text
public $created; // datetime 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. * The One True Thingy that must be defined and declared.
*/ */

View File

@ -56,19 +56,6 @@ class RSVP extends Managed_DataObject
public $response; // tinyint public $response; // tinyint
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -69,22 +69,6 @@ class Profile_detail extends Managed_DataObject
public $created; public $created;
public $modified; 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 * Get an instance by compound key
* *

View File

@ -45,11 +45,6 @@ class Photo extends Managed_DataObject
public $title; // varchar (255) public $title; // varchar (255)
public $description; // text public $description; // text
public $profile_id; // int public $profile_id; // int
public function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('photo', $k, $v);
}
public function getByNotice($notice) public function getByNotice($notice)
{ {

View File

@ -42,11 +42,6 @@ class Video extends Managed_DataObject
public $uri; // varchar (255) // This is the corresponding notice's uri. public $uri; // varchar (255) // This is the corresponding notice's uri.
public $url; // varchar (255) public $url; // varchar (255)
public $profile_id; // int public $profile_id; // int
public function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Video', $k, $v);
}
public function getByNotice($notice) public function getByNotice($notice)
{ {

View File

@ -55,20 +55,6 @@ class ModLog extends Managed_DataObject
public $grant; // 1 = grant, 0 = revoke public $grant; // 1 = grant, 0 = revoke
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -42,11 +42,6 @@ class Ostatus_profile extends Managed_DataObject
public $created; public $created;
public $modified; 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. * Return table definition for Schema setup and DB_DataObject usage.
* *

View File

@ -53,22 +53,6 @@ class User_openid_prefs extends Managed_DataObject
public $created; // datetime public $created; // datetime
public $modified; // 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. * The One True Thingy that must be defined and declared.
*/ */

View File

@ -53,22 +53,6 @@ class Poll extends Managed_DataObject
public $options; // text; newline(?)-delimited public $options; // text; newline(?)-delimited
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -52,22 +52,6 @@ class Poll_response extends Managed_DataObject
public $selection; // int -> choice # public $selection; // int -> choice #
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -50,22 +50,6 @@ class User_poll_prefs extends Managed_DataObject
public $created; // datetime public $created; // datetime
public $modified; // 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. * The One True Thingy that must be defined and declared.
*/ */

View File

@ -55,22 +55,6 @@ class QnA_Answer extends Managed_DataObject
public $content; // text -> response text public $content; // text -> response text
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -55,22 +55,6 @@ class QnA_Question extends Managed_DataObject
public $closed; // int (boolean) whether a question is closed public $closed; // int (boolean) whether a question is closed
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -55,22 +55,6 @@ class QnA_Vote extends Managed_DataObject
public $profile_id; // int -> question.id public $profile_id; // int -> question.id
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -61,21 +61,6 @@ class Realtime_channel extends Managed_DataObject
public $created; // created date public $created; // created date
public $modified; // modified 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 * Get an instance by compound key
* *

View File

@ -50,22 +50,6 @@ class SearchSub extends Managed_DataObject
public $profile_id; // int -> profile.id public $profile_id; // int -> profile.id
public $created; // datetime 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 * Get an instance by compound key
* *

View File

@ -49,22 +49,6 @@ class TagSub extends Managed_DataObject
public $profile_id; // int -> profile.id public $profile_id; // int -> profile.id
public $created; // datetime 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 * Get an instance by compound key
* *