Use Profile objects in Subscription::saveNew

This commit is contained in:
Mikael Nordfeldth 2015-09-06 02:04:12 +02:00
parent 917a547f91
commit a541533e04

View File

@ -101,7 +101,7 @@ class Subscription extends Managed_DataObject
$sub = Subscription_queue::getSubQueue($subscriber, $other); $sub = Subscription_queue::getSubQueue($subscriber, $other);
} }
} else { } else {
$sub = self::saveNew($subscriber->id, $other->id); $sub = self::saveNew($subscriber, $other);
$sub->notify(); $sub->notify();
self::blow('user:notices_with_friends:%d', $subscriber->id); self::blow('user:notices_with_friends:%d', $subscriber->id);
@ -150,12 +150,12 @@ class Subscription extends Managed_DataObject
* Low-level subscription save. * Low-level subscription save.
* Outside callers should use Subscription::start() * Outside callers should use Subscription::start()
*/ */
protected static function saveNew($subscriber_id, $other_id) protected static function saveNew(Profile $subscriber, Profile $other)
{ {
$sub = new Subscription(); $sub = new Subscription();
$sub->subscriber = $subscriber_id; $sub->subscriber = $subscriber->getID();
$sub->subscribed = $other_id; $sub->subscribed = $other->getID();
$sub->jabber = 1; $sub->jabber = 1;
$sub->sms = 1; $sub->sms = 1;
$sub->created = common_sql_now(); $sub->created = common_sql_now();