php-activerecord icon indicating copy to clipboard operation
php-activerecord copied to clipboard

support nested transactions

Open gluk-w opened this issue 10 years ago • 5 comments

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

gluk-w avatar Aug 30 '15 01:08 gluk-w

+1

thijsw avatar Sep 23 '15 09:09 thijsw

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?

jpfuentes2 avatar Apr 22 '16 19:04 jpfuentes2

Thanks @gluk-w! Apart from my notes and @jpfuentes2 note about the formatting I'm ok with this.

koenpunt avatar Apr 24 '16 14:04 koenpunt

And how does this work with the transaction method on the model? Can you add a test for that as well?

koenpunt avatar Apr 24 '16 14:04 koenpunt

Also, do all PDO adapters support savepoints? I believe only postgres and mysql do, so we might take that into account in the implementation.

koenpunt avatar Apr 24 '16 18:04 koenpunt