You are here

public static function OrderConnectStorage::update in Basic cart 8

Same name and namespace in other branches
  1. 8.0 src/OrderConnectStorage.php \Drupal\basic_cart\OrderConnectStorage::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

db_update()

File

src/OrderConnectStorage.php, line 61

Class

OrderConnectStorage
Class OrderConnectStorage.

Namespace

Drupal\basic_cart

Code

public static function update($entry) {
  try {

    // db_update()...->execute() returns the number of rows updated.
    $count = db_update(self::TABLE)
      ->fields($entry)
      ->condition('oid', $entry['oid'])
      ->condition('id', $entry['id'])
      ->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;
}