Closed vatsake closed 5 months ago
Hi there. I think you make a valid suggestion here. However, this isn't something we're going to be working on ourselves anytime soon. We'd appreciate either a PR to the docs or a PR to Octane to implement this. Thank you.
Consider the following code:
If someCondition() is true the first time, then the transaction is not rolled back. If the second time someCondition() is false then the previous transaction's queries are also committed.
I used to code with this in mind:
PHP PDO transactions But since Octane never actually quits, the transaction is not rolled back.
So my suggestion would be to add an event to a listener for example
RequestTerminated
that rolls back any existing transaction. So that unexpected rows aren't committed to the database.