Notice class got exception throwing getById

Less code, more happy.
This commit is contained in:
Mikael Nordfeldth 2015-03-09 17:33:20 +01:00
parent f321c3c2ea
commit aa27c45230
1 changed files with 10 additions and 0 deletions

View 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.
*/