From: Mikael Nordfeldth Date: Mon, 9 Mar 2015 16:33:20 +0000 (+0100) Subject: Notice class got exception throwing getById X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=aa27c452308903050c640c835a94bd388e34f8cf;p=quix0rs-gnu-social.git Notice class got exception throwing getById Less code, more happy. --- diff --git a/classes/Notice.php b/classes/Notice.php index c631c1fcc6..61b18a8710 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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. */