From c32d1b6ffe81afb36fdcaebe0254ad191b72bff6 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 6 Mar 2020 18:37:30 +0100 Subject: Add cli tool to unsubscribe from a topic --- src/phinde/Subscriptions.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/phinde/Subscriptions.php') diff --git a/src/phinde/Subscriptions.php b/src/phinde/Subscriptions.php index 454d191..403f5d4 100644 --- a/src/phinde/Subscriptions.php +++ b/src/phinde/Subscriptions.php @@ -181,22 +181,36 @@ class Subscriptions } /** - * Mark a subscription as "unsubscribed" + * Begin removal of a a subscription: Set its status to "unsubscribing" * * @param integer $subId Subscription ID * * @return void */ - public function unsubscribed($subId) + public function unsubscribing($subId) { $this->db->prepare( 'UPDATE subscriptions' - . ' SET sub_status = "unsubscribed"' + . ' SET sub_status = "unsubscribing"' . ' , sub_updated = NOW()' . ' WHERE sub_id = :id' )->execute([':id' => $subId]); } + /** + * Mark a subscription as "unsubscribed" - delete it + * + * @param integer $subId Subscription ID + * + * @return void + */ + public function unsubscribed($subId) + { + $this->db + ->prepare('DELETE FROM subscriptions WHERE sub_id = :id') + ->execute([':id' => $subId]); + } + /** * Subscription has been cancelled/denied for some reason * -- cgit v1.2.3