]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Notice class got exception throwing getById
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 9 Mar 2015 16:33:20 +0000 (17:33 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 9 Mar 2015 16:33:20 +0000 (17:33 +0100)
Less code, more happy.

classes/Notice.php

index c631c1fcc6768dd690bb449c8115096c1806f644..61b18a8710a3f44f1bc413db414bcb0503d2cf51 100644 (file)
@@ -313,6 +313,16 @@ class Notice extends Managed_DataObject
         return $notice;
     }
 
+    public static function getById($id)
+    {
+        $notice = new Notice();
+        $notice->id = $id;
+        if (!$notice->find(true)) {
+            throw new NoResultException($notice);
+        }
+        return $notice;
+    }
+
     /**
      * Extract #hashtags from this notice's content and save them to the database.
      */