You are here

public function Subscription::unsubscribe in Feeds 8.3

Unsubscribes from a hub.

Overrides SubscriptionInterface::unsubscribe

File

src/Entity/Subscription.php, line 36

Class

Subscription
Defines the subscription entity class.

Namespace

Drupal\feeds\Entity

Code

public function unsubscribe() {
  $this
    ->validateState();
  switch ($this
    ->getState()) {
    case 'subscribed':
    case 'subscribing':
      $this
        ->set('state', 'unsubscribing');
      break;
  }
  $this
    ->delete();
}