Issue #2801899 by shashikant_chauhan, daffie, axel.rutz: Rename Drupal\Core\Database\Connection::rollback() to Drupal\Core\Database\Connection::rollBack()

8.3.x
Nathaniel Catchpole 2016-10-13 10:38:32 +01:00
parent 55469c5016
commit 9f26c56909
13 changed files with 31 additions and 31 deletions

View File

@ -1083,9 +1083,9 @@ abstract class Connection {
* @throws \Drupal\Core\Database\TransactionOutOfOrderException
* @throws \Drupal\Core\Database\TransactionNoActiveException
*
* @see \Drupal\Core\Database\Transaction::rollback()
* @see \Drupal\Core\Database\Transaction::rollBack()
*/
public function rollback($savepoint_name = 'drupal_transaction') {
public function rollBack($savepoint_name = 'drupal_transaction') {
if (!$this->supportsTransactions()) {
return;
}
@ -1179,7 +1179,7 @@ abstract class Connection {
// The transaction has already been committed earlier. There is nothing we
// need to do. If this transaction was part of an earlier out-of-order
// rollback, an exception would already have been thrown by
// Database::rollback().
// Database::rollBack().
if (!isset($this->transactionLayers[$name])) {
return;
}

View File

@ -432,7 +432,7 @@ class Connection extends DatabaseConnection {
*/
public function rollbackSavepoint($savepoint_name = 'mimic_implicit_commit') {
if (isset($this->transactionLayers[$savepoint_name])) {
$this->rollback($savepoint_name);
$this->rollBack($savepoint_name);
}
}

View File

@ -59,7 +59,7 @@ class Upsert extends QueryUpsert {
}
catch (\Exception $e) {
// One of the queries failed, rollback the whole batch.
$transaction->rollback();
$transaction->rollBack();
// Rethrow the exception for the calling code.
throw $e;

View File

@ -91,7 +91,7 @@ class Insert extends Query implements \Countable {
}
catch (\Exception $e) {
// One of the INSERTs failed, rollback the whole batch.
$transaction->rollback();
$transaction->rollBack();
// Rethrow the exception for the calling code.
throw $e;
}

View File

@ -86,12 +86,12 @@ class Transaction {
* transaction has been rolled back or the log messages will be rolled back
* too.
*
* @see \Drupal\Core\Database\Connection::rollback()
* @see \Drupal\Core\Database\Connection::rollBack()
* @see watchdog_exception()
*/
public function rollback() {
public function rollBack() {
$this->rolledBack = TRUE;
$this->connection->rollback($this->name);
$this->connection->rollBack($this->name);
}
}

View File

@ -3,6 +3,6 @@
namespace Drupal\Core\Database;
/**
* Exception thrown when a rollback() resulted in other active transactions being rolled-back.
* Exception thrown when a rollBack() resulted in other active transactions being rolled-back.
*/
class TransactionOutOfOrderException extends TransactionException implements DatabaseException { }

View File

@ -175,7 +175,7 @@
* }
* catch (Exception $e) {
* // Something went wrong somewhere, so roll back now.
* $txn->rollback();
* $txn->rollBack();
* // Log the exception to watchdog.
* watchdog_exception('type', $e);
* }

View File

@ -713,7 +713,7 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
db_ignore_replica();
}
catch (\Exception $e) {
$transaction->rollback();
$transaction->rollBack();
watchdog_exception($this->entityTypeId, $e);
throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
}
@ -765,7 +765,7 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
return $return;
}
catch (\Exception $e) {
$transaction->rollback();
$transaction->rollBack();
watchdog_exception($this->entityTypeId, $e);
throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
}

View File

@ -316,7 +316,7 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage
}
catch (\Exception $e) {
if ($this->database->supportsTransactionalDDL()) {
$transaction->rollback();
$transaction->rollBack();
}
else {
// Recreate original schema.
@ -1271,7 +1271,7 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage
}
catch (\Exception $e) {
if ($this->database->supportsTransactionalDDL()) {
$transaction->rollback();
$transaction->rollBack();
}
else {
// Recreate tables.
@ -1362,7 +1362,7 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage
}
catch (\Exception $e) {
if ($this->database->supportsTransactionalDDL()) {
$transaction->rollback();
$transaction->rollBack();
}
else {
// Recreate original schema.

View File

@ -63,7 +63,7 @@ class MenuRouterRebuildSubscriber implements EventSubscriberInterface {
db_ignore_replica();
}
catch (\Exception $e) {
$transaction->rollback();
$transaction->rollBack();
watchdog_exception('menu', $e);
}

View File

@ -315,7 +315,7 @@ class MenuTreeStorage implements MenuTreeStorageInterface {
$this->updateParentalStatus($link);
}
catch (\Exception $e) {
$transaction->rollback();
$transaction->rollBack();
throw $e;
}
return $affected_menus;

View File

@ -144,7 +144,7 @@ class MatcherDumper implements MatcherDumperInterface {
}
catch (\Exception $e) {
$transaction->rollback();
$transaction->rollBack();
watchdog_exception('Routing', $e);
throw $e;
}

View File

@ -75,8 +75,8 @@ class TransactionTest extends DatabaseTestBase {
if ($rollback) {
// Roll back the transaction, if requested.
// This rollback should propagate to the last savepoint.
$txn->rollback();
$this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollback().');
$txn->rollBack();
$this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollBack().');
}
}
@ -135,8 +135,8 @@ class TransactionTest extends DatabaseTestBase {
if ($rollback) {
// Roll back the transaction, if requested.
// This rollback should propagate to the last savepoint.
$txn->rollback();
$this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollback().');
$txn->rollBack();
$this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollBack().');
}
}
@ -254,7 +254,7 @@ class TransactionTest extends DatabaseTestBase {
unset($transaction2);
$transaction3 = db_transaction();
$this->insertRow('row');
$transaction3->rollback();
$transaction3->rollBack();
unset($transaction3);
unset($transaction);
$this->assertRowAbsent('row');
@ -267,7 +267,7 @@ class TransactionTest extends DatabaseTestBase {
$transaction = db_transaction();
$this->insertRow('row');
$this->executeDDLStatement();
$transaction->rollback();
$transaction->rollBack();
unset($transaction);
$this->assertRowAbsent('row');
@ -280,7 +280,7 @@ class TransactionTest extends DatabaseTestBase {
$transaction3 = db_transaction();
$this->insertRow('row');
unset($transaction3);
$transaction->rollback();
$transaction->rollBack();
unset($transaction);
$this->assertRowAbsent('row');
}
@ -293,7 +293,7 @@ class TransactionTest extends DatabaseTestBase {
$this->executeDDLStatement();
// Rollback the outer transaction.
try {
$transaction->rollback();
$transaction->rollBack();
unset($transaction);
// @TODO: an exception should be triggered here, but is not, because
// "ROLLBACK" fails silently in MySQL if there is no transaction active.
@ -424,7 +424,7 @@ class TransactionTest extends DatabaseTestBase {
$transaction2 = db_transaction();
$this->insertRow('inner');
// Now rollback the inner transaction.
$transaction2->rollback();
$transaction2->rollBack();
unset($transaction2);
$this->assertTrue($database->inTransaction(), 'Still in a transaction after popping the outer transaction');
// Pop the outer transaction, it should commit.
@ -445,7 +445,7 @@ class TransactionTest extends DatabaseTestBase {
unset($transaction);
$this->assertTrue($database->inTransaction(), 'Still in a transaction after popping the outer transaction');
// Now rollback the inner transaction, it should rollback.
$transaction2->rollback();
$transaction2->rollBack();
unset($transaction2);
$this->assertFalse($database->inTransaction(), 'Transaction closed after popping the inner transaction');
$this->assertRowPresent('outer');
@ -463,7 +463,7 @@ class TransactionTest extends DatabaseTestBase {
$this->insertRow('inner2');
// Rollback the outer transaction.
try {
$transaction->rollback();
$transaction->rollBack();
unset($transaction);
$this->fail('Rolling back the outer transaction while the inner transaction is active resulted in an exception.');
}
@ -476,7 +476,7 @@ class TransactionTest extends DatabaseTestBase {
$this->pass('Trying to commit an inner transaction resulted in an exception.');
// Try to rollback one inner transaction.
try {
$transaction->rollback();
$transaction->rollBack();
unset($transaction2);
$this->fail('Trying to commit an inner transaction resulted in an exception.');
}