From a9676f5b2b8653baecf70a3436152aff98d9d7c0 Mon Sep 17 00:00:00 2001
From: Mikael Nordfeldth <mmn@hethane.se>
Date: Tue, 5 Aug 2014 12:42:30 +0200
Subject: [PATCH] RSVP fromNotice now throws NoResultException

---
 plugins/Event/classes/RSVP.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/plugins/Event/classes/RSVP.php b/plugins/Event/classes/RSVP.php
index 31ccf439ef..de3307fad4 100644
--- a/plugins/Event/classes/RSVP.php
+++ b/plugins/Event/classes/RSVP.php
@@ -226,7 +226,12 @@ class RSVP extends Managed_DataObject
 
     static function fromNotice(Notice $notice)
     {
-        return RSVP::getKV('uri', $notice->uri);
+        $rsvp = new RSVP();
+        $rsvp->uri = $notice->uri;
+        if (!$rsvp->find(true)) {
+            throw new NoResultException($rsvp);
+        }
+        return $rsvp;
     }
 
     static function forEvent(Happening $event)
-- 
2.39.5