php-activerecord
php-activerecord copied to clipboard
support nested transactions
I added support for nested transactions. So it is safe to start transaction and call methods that also use transactions. Implementation idea is taken from http://php.net/manual/en/pdo.begintransaction.php#116669
+1
This is a very useful feature and can help speed up integration tests which use the DB/fixtures by using savepoints rather than DELETE or TRUNCATE esp. for Postgres.
Thanks a lot for adding a test, @gluk-w. Would you mind fixing your formatting to match the style of this codebase?
Thanks @gluk-w! Apart from my notes and @jpfuentes2 note about the formatting I'm ok with this.
And how does this work with the transaction method on the model? Can you add a test for that as well?
Also, do all PDO adapters support savepoints? I believe only postgres and mysql do, so we might take that into account in the implementation.