public static function CartStorage::update in Basic cart 8
Same name and namespace in other branches
- 8.6 src/CartStorage.php \Drupal\basic_cart\CartStorage::update()
- 8.0 src/CartStorage.php \Drupal\basic_cart\CartStorage::update()
- 8.2 src/CartStorage.php \Drupal\basic_cart\CartStorage::update()
- 8.3 src/CartStorage.php \Drupal\basic_cart\CartStorage::update()
- 8.4 src/CartStorage.php \Drupal\basic_cart\CartStorage::update()
- 8.5 src/CartStorage.php \Drupal\basic_cart\CartStorage::update()
Update an entry in the database.
Parameters
array $entry: An array containing all the fields of the item to be updated.
Return value
int The number of updated rows.
See also
File
- src/
CartStorage.php, line 61
Class
- CartStorage
- Class CartStorage.
Namespace
Drupal\basic_cartCode
public static function update($entry) {
try {
// db_update()...->execute() returns the number of rows updated.
$count = db_update(self::TABLE)
->fields($entry)
->condition('uid', $entry['uid'])
->condition('id', $entry['id'])
->condition('entitytype', $entry['entitytype'])
->execute();
} catch (\Exception $e) {
drupal_set_message(t('db_update failed. Message = %message, query= %query', array(
'%message' => $e
->getMessage(),
'%query' => $e->query_string,
)), 'error');
}
return $count;
}