]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/QnA/classes/QnA_Vote.php
Merge remote-tracking branch 'upstream/master'
[quix0rs-gnu-social.git] / plugins / QnA / classes / QnA_Vote.php
index ec2e75afbb9855ada1d536a642e12f1d5f1374f9..9bed5b15b3439e5742662bc1dd8aa5ba3c314fe0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Data class to save users votes for 
+ * Data class to save users votes for
  *
  * PHP version 5
  *
@@ -46,48 +46,15 @@ class QnA_Vote extends Managed_DataObject
 {
     const UP   = 'http://activitystrea.ms/schema/1.0/like';
     const DOWN = 'http://activityschema.org/object/dislike'; // Gar!
-    
-    public $__table = 'qa_vote'; // table name
+
+    public $__table = 'qna_vote'; // table name
     public $id;          // char(36) primary key not null -> UUID
     public $question_id; // char(36) -> question.id UUID
     public $answer_id;   // char(36) -> question.id UUID
-    public $type         // tinyint -> vote: up (1) or down (-1)
+    public $type;        // tinyint -> vote: up (1) or down (-1)
     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
-     *
-     * 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 QnA_Vote object found, or null for no hits
-     *
-     */
-    function pkeyGet($kv)
-    {
-        return Memcached_DataObject::pkeyGet('QnA_Vote', $kv);
-    }
-
     /**
      * The One True Thingy that must be defined and declared.
      */
@@ -97,20 +64,20 @@ class QnA_Vote extends Managed_DataObject
             'description' => 'For storing votes on questions and answers',
             'fields' => array(
                 'id' => array(
-                    'type'        => 'char', 
-                    'length'      => 36, 
-                    'not null'    => true, 
+                    'type'        => 'char',
+                    'length'      => 36,
+                    'not null'    => true,
                     'description' => 'UUID of the vote'
                 ),
                 'question_id' => array(
-                    'type'        => 'char', 
-                    'length'      => 36, 
-                    'not null'    => true, 
+                    'type'        => 'char',
+                    'length'      => 36,
+                    'not null'    => true,
                     'description' => 'UUID of question being voted on'
                 ),
                 'answer_id' => array(
-                    'type'        => 'char', 
-                    'length'      => 36, 
+                    'type'        => 'char',
+                    'length'      => 36,
                     'not null'    => true,
                     'description' => 'UUID of answer being voted on'
                 ),
@@ -121,11 +88,11 @@ class QnA_Vote extends Managed_DataObject
             'primary key' => array('id'),
             'indexes' => array(
                 'profile_id_question_Id_index' => array(
-                    'profile_id', 
+                    'profile_id',
                     'question_id'
                 ),
                 'profile_id_question_Id_index' => array(
-                    'profile_id', 
+                    'profile_id',
                     'answer_id'
                 )
             )
@@ -153,8 +120,8 @@ class QnA_Vote extends Managed_DataObject
         $v->vote        = $vote;
         $v->created     = common_sql_now();
 
-        common_log(LOG_DEBUG, "Saving vote: $v->id $v->vote");
-        
+        common_debug("Saving vote: $v->id $v->vote");
+
         $v->insert();
     }
 }