You are here

public static function CartStorage::delete in Basic cart 8

Same name and namespace in other branches
  1. 8.6 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
  2. 8.0 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
  3. 8.2 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
  4. 8.3 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
  5. 8.4 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
  6. 8.5 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()

Delete an entry from the database.

Parameters

array $entry: An array containing at least the person identifier 'pid' element of the entry to delete.

See also

db_delete()

File

src/CartStorage.php, line 90

Class

CartStorage
Class CartStorage.

Namespace

Drupal\basic_cart

Code

public static function delete($entry) {
  $delete = db_delete(self::TABLE);
  if ($entry['uid']) {
    $delete
      ->condition('uid', $entry['uid']);
  }
  if ($entry['id']) {
    $delete
      ->condition('id', $entry['id']);
    $delete
      ->condition('entitytype', $entry['entitytype'] ? $entry['entitytype'] : 'node');
  }
  $delete
    ->execute();
}