TransactionCommitFailedException example

protected function doCommit() {
    $success = $this->connection->commit();
    if (!empty($this->rootTransactionEndCallbacks)) {
      $callbacks = $this->rootTransactionEndCallbacks;
      $this->rootTransactionEndCallbacks = [];
      foreach ($callbacks as $callback) {
        call_user_func($callback$success);
      }
    }

    if (!$success) {
      throw new TransactionCommitFailedException();
    }
  }

  /** * Runs a limited-range query on this database object. * * Use this as a substitute for ->query() when a subset of the query is to be * returned. User-supplied arguments to the query should be passed in as * separate parameters so that they can be properly escaped to avoid SQL * injection attacks. * * @param string $query * A string containing an SQL query. * @param int $from * The first result row to return. * @param int $count * The maximum number of result rows to return. * @param array $args * (optional) An array of values to substitute into the query at placeholder * markers. * @param array $options * (optional) An array of options on the query. * * @return \Drupal\Core\Database\StatementInterface * A database query result resource, or NULL if the query was not executed * correctly. */
Home | Imprint | This part of the site doesn't use cookies.