Throw exception if subscription is invalid

This commit is contained in:
Evan Prodromou 2013-06-08 14:56:57 -04:00
parent 7ad5ed1db9
commit 2252a9ffaf

View File

@ -67,7 +67,7 @@ class Subscription extends Managed_DataObject
'subscription_token_idx' => array('token'),
),
);
}
}
/* Static get */
function staticGet($k,$v=null)
@ -262,6 +262,14 @@ class Subscription extends Managed_DataObject
$subscriber = Profile::staticGet('id', $this->subscriber);
$subscribed = Profile::staticGet('id', $this->subscribed);
if (empty($subscriber)) {
throw new Exception(sprintf(_('No profile for the subscriber: %d'), $this->subscriber));
}
if (empty($subscribed)) {
throw new Exception(sprintf(_('No profile for the subscribed: %d'), $this->subscribed));
}
$act = new Activity();
$act->verb = ActivityVerb::FOLLOW;