Use exceptions for Notice::getByUri

..jeez, a long time since I commited. Three in a row to get this right. Sorry :)
This commit is contained in:
Mikael Nordfeldth 2014-01-12 22:46:50 +01:00
parent 08dba7e21d
commit edee39790e
1 changed files with 6 additions and 1 deletions

View File

@ -218,7 +218,12 @@ class Notice extends Managed_DataObject
public static function getByUri($uri)
{
return static::getKV('uri', $uri);
$notice = new Notice();
$notice->uri = $uri;
if (!$notice->find(true)) {
throw new NoResultException($notice);
}
return $notice;
}
/**