We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multiple Database Transactions

Multiple Database Transactions

Hi, I'm wondering if is posible to handle more than one transaction to the same database and the same connection at the same time.

The transactions will save different entities so one may fail but the other may not.

Is that posible? I should use two instances of transaction managers?

I read the documentation of Phalcon\Mvc\Model\Transaction\Manager and the method get returns a new transaction or an already created one.

Thank you in advance for your help.



11.6k

the purpose of transaction is to try to do consecutives / separate operation and to commit them if all succeed (or cancel the whole statements if one of them fail)..so you do not have to initiate multiple transaction, only one inside which you will group your database queries, then do the commit at end..