doctrine/dbal — pull request #634 by BenMorel (2014-07-21 23:14:40+00:00)
Title: Transaction object definition

To move forward with the Transaction Object, here is an alternative proposal to #571.

This keeps the same basic idea, but now `createTransaction()` returns a `TransactionDefinition` object, which is configurable, and has a `begin()` method that starts the underlying transaction and returns the `Transaction` object:

$tx = $em->createTransaction() // TransactionDefinition
->withIsolationLevel(Connection::TRANSACTION_SERIALIZABLE) // TransactionDefinition
->begin(); // Transaction

I think that this implementation checks all the boxes:
- Clear separation between the Transaction and its Definition
- Once the Transaction is created, its Definition is set and cannot be changed
- No risk to forget to call `begin()`: if you do, you'll deal with a TransactionDefinition and just get a *call to undefined method* if you try to `commit()` it. Plus, your IDE will be able to warn you while coding.

And needless to say, we're still keeping 100% BC compatibility.

What do you think?