]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Fave.php
Replace common_good_random with common_random_hexstr
[quix0rs-gnu-social.git] / classes / Fave.php
index 59a1e00318c2dfe8cf94ee15c5123fde0dd1f0b5..53d60b3a8202138ef58cf2cd6bbf6f8dbeb67444 100644 (file)
@@ -15,10 +15,6 @@ class Fave extends Managed_DataObject
     public $uri;                             // varchar(255)
     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
 
-    /* Static get */
-    function staticGet($k,$v=null)
-    { return Memcached_DataObject::staticGet('Fave',$k,$v); }
-
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
@@ -84,8 +80,8 @@ class Fave extends Managed_DataObject
 
     function delete()
     {
-        $profile = Profile::staticGet('id', $this->user_id);
-        $notice  = Notice::staticGet('id', $this->notice_id);
+        $profile = Profile::getKV('id', $this->user_id);
+        $notice  = Notice::getKV('id', $this->notice_id);
 
         $result = null;
 
@@ -103,11 +99,6 @@ class Fave extends Managed_DataObject
         return $result;
     }
 
-    function pkeyGet($kv)
-    {
-        return Memcached_DataObject::pkeyGet('Fave', $kv);
-    }
-
     function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0)
     {
         $stream = new FaveNoticeStream($user_id, $own);
@@ -124,8 +115,17 @@ class Fave extends Managed_DataObject
 
     function asActivity()
     {
-        $notice  = Notice::staticGet('id', $this->notice_id);
-        $profile = Profile::staticGet('id', $this->user_id);
+        $notice = Notice::getKV('id', $this->notice_id);
+
+        if (!$notice) {
+            throw new Exception("Fave for non-existent notice: " . $this->notice_id);
+        }
+
+        $profile = Profile::getKV('id', $this->user_id);
+
+        if (!$profile) {
+            throw new Exception("Fave by non-existent profile: " . $this->user_id);
+        }
 
         $act = new Activity();