From aa27c452308903050c640c835a94bd388e34f8cf Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 9 Mar 2015 17:33:20 +0100 Subject: [PATCH] Notice class got exception throwing getById Less code, more happy. --- classes/Notice.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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. */ -- 2.39.2