Affects Version/s: None
Fix Version/s: None
Security Level: All
This issue is created automatically through a Github pull request on behalf of BenMorel:
This is a first draft on the idea of a Transaction object, as suggested by @guilhermeblanco and @beberlei in doctrine/doctrine2#949.
This makes the following changes to `Connection`:
- *Adds* the following methods:
- `createTransaction()` : begins a transaction and returns the associated `Transaction` object
- `getTransactionManager()` : returns the `TransactionManager`
- *Deprecates* `beginTransaction()` in favour of `createTransaction()`
- *Deprecates* the following methods, in favour of their counterparts on `Transaction`:
- *Deprecates* the following methods, in favour of their counterparts on `TransactionManager`:
The new way of dealing with transactions is then:
$transaction = $connection->createTransaction();
It also automatically propagates `commit()` and `rollback()` to nested transactions:
$transaction1 = $connection->createTransaction();
$transaction2 = $connection->createTransaction();
$transaction1->commit(); // will commit $transaction2 then $transaction1
Overall, it's not a complicated change, does not introduce any BC break, and passes all existing tests.
I'm looking forward to hearing what you think!