diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2020-03-06 18:37:30 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2020-03-06 18:37:30 +0100 |
| commit | c32d1b6ffe81afb36fdcaebe0254ad191b72bff6 (patch) | |
| tree | b4322c9d6e5be60faeb28b566b04d7d4b1dbb693 /src/phinde/Subscriptions.php | |
| parent | 973ef8c4f8c15848dfc135e11053e5eb6f5dcdb7 (diff) | |
| download | phinde-c32d1b6ffe81afb36fdcaebe0254ad191b72bff6.tar.gz phinde-c32d1b6ffe81afb36fdcaebe0254ad191b72bff6.zip | |
Add cli tool to unsubscribe from a topic
Diffstat (limited to 'src/phinde/Subscriptions.php')
| -rw-r--r-- | src/phinde/Subscriptions.php | 20 |
1 files changed, 17 insertions, 3 deletions
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,23 +181,37 @@ 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 * * @param integer $subId Subscription ID |
