public function SubscriptionStorage::deleteSubscriptions in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Subscription/SubscriptionStorage.php \Drupal\simplenews\Subscription\SubscriptionStorage::deleteSubscriptions()
- 3.x src/Subscription/SubscriptionStorage.php \Drupal\simplenews\Subscription\SubscriptionStorage::deleteSubscriptions()
Deletes subscriptions.
Parameters
array $conditions: An associative array of conditions matching the records to be delete. Example: array('newsletter_id' => 5, 'snid' => 12) Delete the subscription of subscriber 12 to newsletter newsletter_id 5.
Overrides SubscriptionStorageInterface::deleteSubscriptions
File
- src/
Subscription/ SubscriptionStorage.php, line 17
Class
- SubscriptionStorage
- Default subscription storage.
Namespace
Drupal\simplenews\SubscriptionCode
public function deleteSubscriptions($conditions = array()) {
$table_name = 'simplenews_subscriber__subscriptions';
if (!Database::getConnection()
->schema()
->tableExists($table_name)) {
// This can happen if this is called during uninstall.
return;
}
$query = $this->database
->delete($table_name);
foreach ($conditions as $key => $condition) {
$query
->condition($key, $condition);
}
$query
->execute();
$this
->resetCache();
}