Commit 1c6751e0 authored by David McKay's avatar David McKay

Fixing method name 'rollBack', which was documented as 'rollback'

parent c83a43c3
...@@ -4,7 +4,7 @@ Transactions ...@@ -4,7 +4,7 @@ Transactions
A ``Doctrine\DBAL\Connection`` provides a PDO-like API for A ``Doctrine\DBAL\Connection`` provides a PDO-like API for
transaction management, with the methods transaction management, with the methods
``Connection#beginTransaction()``, ``Connection#commit()`` and ``Connection#beginTransaction()``, ``Connection#commit()`` and
``Connection#rollback()``. ``Connection#rollBack()``.
Transaction demarcation with the Doctrine DBAL looks as follows: Transaction demarcation with the Doctrine DBAL looks as follows:
...@@ -16,7 +16,7 @@ Transaction demarcation with the Doctrine DBAL looks as follows: ...@@ -16,7 +16,7 @@ Transaction demarcation with the Doctrine DBAL looks as follows:
// do stuff // do stuff
$conn->commit(); $conn->commit();
} catch(Exception $e) { } catch(Exception $e) {
$conn->rollback(); $conn->rollBack();
throw $e; throw $e;
} }
...@@ -60,9 +60,9 @@ transactions, or rather propagating transaction control up the call ...@@ -60,9 +60,9 @@ transactions, or rather propagating transaction control up the call
stack. For that purpose, the ``Connection`` class keeps an internal stack. For that purpose, the ``Connection`` class keeps an internal
counter that represents the nesting level and is counter that represents the nesting level and is
increased/decreased as ``beginTransaction()``, ``commit()`` and increased/decreased as ``beginTransaction()``, ``commit()`` and
``rollback()`` are invoked. ``beginTransaction()`` increases the ``rollBack()`` are invoked. ``beginTransaction()`` increases the
nesting level whilst nesting level whilst
``commit()`` and ``rollback()`` decrease the nesting level. The nesting level starts at 0. Whenever the nesting level transitions from 0 to 1, ``beginTransaction()`` is invoked on the underlying driver connection and whenever the nesting level transitions from 1 to 0, ``commit()`` or ``rollback()`` is invoked on the underlying driver, depending on whether the transition was caused by ``Connection#commit()`` or ``Connection#rollback()``. ``commit()`` and ``rollBack()`` decrease the nesting level. The nesting level starts at 0. Whenever the nesting level transitions from 0 to 1, ``beginTransaction()`` is invoked on the underlying driver connection and whenever the nesting level transitions from 1 to 0, ``commit()`` or ``rollBack()`` is invoked on the underlying driver, depending on whether the transition was caused by ``Connection#commit()`` or ``Connection#rollBack()``.
What this means is that transaction control is basically passed to What this means is that transaction control is basically passed to
code higher up in the call stack and the inner transaction block is code higher up in the call stack and the inner transaction block is
...@@ -91,7 +91,7 @@ example: ...@@ -91,7 +91,7 @@ example:
$conn->commit(); // 2 => 1 $conn->commit(); // 2 => 1
} catch (Exception $e) { } catch (Exception $e) {
$conn->rollback(); // 2 => 1, transaction marked for rollback only $conn->rollBack(); // 2 => 1, transaction marked for rollback only
throw $e; throw $e;
} }
...@@ -99,7 +99,7 @@ example: ...@@ -99,7 +99,7 @@ example:
$conn->commit(); // 1 => 0, "real" transaction committed $conn->commit(); // 1 => 0, "real" transaction committed
} catch (Exception $e) { } catch (Exception $e) {
$conn->rollback(); // 1 => 0, "real" transaction rollback $conn->rollBack(); // 1 => 0, "real" transaction rollback
throw $e; throw $e;
} }
...@@ -136,7 +136,7 @@ wider scope and the control is handed to the outer scope. ...@@ -136,7 +136,7 @@ wider scope and the control is handed to the outer scope.
.. warning:: .. warning::
Directly invoking ``PDO#beginTransaction()``, Directly invoking ``PDO#beginTransaction()``,
``PDO#commit()`` or ``PDO#rollback()`` or the corresponding methods ``PDO#commit()`` or ``PDO#rollBack()`` or the corresponding methods
on the particular ``Doctrine\DBAL\Driver\Connection`` instance in on the particular ``Doctrine\DBAL\Driver\Connection`` instance in
use bypasses the transparent transaction nesting that is provided use bypasses the transparent transaction nesting that is provided
by ``Doctrine\DBAL\Connection`` and can therefore corrupt the by ``Doctrine\DBAL\Connection`` and can therefore corrupt the
...@@ -152,7 +152,7 @@ transaction or directly be committed to the database. ...@@ -152,7 +152,7 @@ transaction or directly be committed to the database.
By default a connection runs in auto-commit mode which means By default a connection runs in auto-commit mode which means
that it is non-transactional unless you start a transaction explicitly that it is non-transactional unless you start a transaction explicitly
via ``beginTransaction()``. To have a connection automatically open up via ``beginTransaction()``. To have a connection automatically open up
a new transaction on ``connect()`` and after ``commit()`` or ``rollback()``, a new transaction on ``connect()`` and after ``commit()`` or ``rollBack()``,
you can disable auto-commit mode with ``setAutoCommit(false)``. you can disable auto-commit mode with ``setAutoCommit(false)``.
:: ::
...@@ -169,7 +169,7 @@ you can disable auto-commit mode with ``setAutoCommit(false)``. ...@@ -169,7 +169,7 @@ you can disable auto-commit mode with ``setAutoCommit(false)``.
// do stuff // do stuff
$conn->commit(); // commits transaction and immediately starts a new one $conn->commit(); // commits transaction and immediately starts a new one
} catch (\Exception $e) { } catch (\Exception $e) {
$conn->rollback(); // rolls back transaction and immediately starts a new one $conn->rollBack(); // rolls back transaction and immediately starts a new one
} }
// still transactional // still transactional
...@@ -220,14 +220,14 @@ by this behaviour. ...@@ -220,14 +220,14 @@ by this behaviour.
// do stuff // do stuff
$conn->commit(); // commits inner transaction, does not start a new one $conn->commit(); // commits inner transaction, does not start a new one
} catch (\Exception $e) { } catch (\Exception $e) {
$conn->rollback(); // rolls back inner transaction, does not start a new one $conn->rollBack(); // rolls back inner transaction, does not start a new one
} }
// do stuff // do stuff
$conn->commit(); // commits outer transaction, and immediately starts a new one $conn->commit(); // commits outer transaction, and immediately starts a new one
} catch (\Exception $e) { } catch (\Exception $e) {
$conn->rollback(); // rolls back outer transaction, and immediately starts a new one $conn->rollBack(); // rolls back outer transaction, and immediately starts a new one
} }
...@@ -235,4 +235,3 @@ To initialize a ``Doctrine\DBAL\Connection`` with auto-commit disabled, ...@@ -235,4 +235,3 @@ To initialize a ``Doctrine\DBAL\Connection`` with auto-commit disabled,
you can also use the ``Doctrine\DBAL\Configuration`` container to modify the you can also use the ``Doctrine\DBAL\Configuration`` container to modify the
default auto-commit mode via ``Doctrine\DBAL\Configuration::setAutoCommit(false)`` default auto-commit mode via ``Doctrine\DBAL\Configuration::setAutoCommit(false)``
and pass it to a ``Doctrine\DBAL\Connection`` when instantiating. and pass it to a ``Doctrine\DBAL\Connection`` when instantiating.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment