public static function CartStorage::delete in Basic cart 8.6
Same name and namespace in other branches
- 8 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
- 8.0 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
- 8.2 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
- 8.3 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
- 8.4 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
- 8.5 src/CartStorage.php \Drupal\basic_cart\CartStorage::delete()
Delete a cart entry from the database.
Parameters
array $entry: An array containing at least the person identifier 'pid' element of the entry to delete.
See also
File
- src/
CartStorage.php, line 87
Class
- CartStorage
- Class CartStorage.
Namespace
Drupal\basic_cartCode
public static function delete(array $entry) {
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
$delete = \Drupal::database()
->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();
}