X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FQnA%2Fclasses%2FQnA_Question.php;h=079f09fb6bf46143383d64a343a1f37ba93ba8e6;hb=43a7262d3bdffe531317ac4b8248aeddec6c9935;hp=58a9cd5e183fd24fc25523f6ba002c7dfd94d794;hpb=2a4dc77a633cc78907934fd93200ac16d55be78e;p=quix0rs-gnu-social.git diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php index 58a9cd5e18..079f09fb6b 100644 --- a/plugins/QnA/classes/QnA_Question.php +++ b/plugins/QnA/classes/QnA_Question.php @@ -48,30 +48,13 @@ class QnA_Question extends Managed_DataObject public $__table = 'qna_question'; // table name public $id; // char(36) primary key not null -> UUID - public $uri; + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $profile_id; // int -> profile.id public $title; // text public $description; // text public $closed; // int (boolean) whether a question is closed public $created; // datetime - /** - * Get an instance by compound key - * - * This is a utility method to get a single instance with a given set of - * key-value pairs. Usually used for the primary key for a compound key; thus - * the name. - * - * @param array $kv array of key-value mappings - * - * @return Bookmark object found, or null for no hits - * - */ - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('QnA_Question', $kv); - } - /** * The One True Thingy that must be defined and declared. */ @@ -88,7 +71,7 @@ class QnA_Question extends Managed_DataObject ), 'uri' => array( 'type' => 'varchar', - 'length' => 255, + 'length' => 191, 'not null' => true ), 'profile_id' => array('type' => 'int'), @@ -114,7 +97,7 @@ class QnA_Question extends Managed_DataObject * * @return Question found question or null */ - static function getByNotice($notice) + static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -124,9 +107,9 @@ class QnA_Question extends Managed_DataObject return Notice::getKV('uri', $this->uri); } - function bestUrl() + function getUrl() { - return $this->getNotice()->bestUrl(); + return $this->getNotice()->getUrl(); } function getProfile() @@ -181,7 +164,7 @@ class QnA_Question extends Managed_DataObject return $a->count(); } - static function fromNotice($notice) + static function fromNotice(Notice $notice) { return QnA_Question::getKV('uri', $notice->uri); } @@ -196,7 +179,7 @@ class QnA_Question extends Managed_DataObject return self::toString($this->getProfile(), $this); } - static function toHTML($profile, $question) + static function toHTML(Profile $profile, $question) { $notice = $question->getNotice(); @@ -254,7 +237,7 @@ class QnA_Question extends Managed_DataObject * * @return Notice saved notice */ - static function saveNew($profile, $title, $description, $options = array()) + static function saveNew(Profile $profile, $title, $description, array $options = array()) { $q = new QnA_Question(); @@ -278,7 +261,7 @@ class QnA_Question extends Managed_DataObject ); } - common_log(LOG_DEBUG, "Saving question: $q->id $q->uri"); + common_debug("Saving question: $q->id $q->uri"); $q->insert(); if (Notice::contentTooLong($q->title . ' ' . $q->uri)) {