1

I was wondering if there is a function such as mysql rollback commit available in Zend Framework 2?

I need to insert multiply rows in the same tabel coming from one form submit.

Nick

directory
  • 3,093
  • 8
  • 45
  • 85
  • 1
    The answer was also posted here -> http://stackoverflow.com/questions/14228003/zend-2-db-transactions/14259278#14259278 – Diemuzi Feb 07 '13 at 22:11

2 Answers2

2

In ZF2, the beginTransaction(), commit() and rollback() methods are in the ConnectionInterface.

As far as I can see, you probably have to write code something like this:

$dbAdapter->getDriver()->getConnection()->beginTransaction();
. . . 
$dbAdapter->getDriver()->getConnection()->commit();

See: http://framework.zend.com/apidoc/2.1/classes/Zend.Db.Adapter.Driver.ConnectionInterface.html

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
0

This cannot be used to update two tables in the same transaction.

Nisal Gunawardana
  • 1,345
  • 16
  • 20