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:
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?