ZF2 Db Transactions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ZF2 Db Transactions

This post has NOT been accepted by the mailing list yet.
Now that RC1 is out I'd like to start playing around a little more. I'm using the default example of PDO_mySQL with TableGateway to handle my database connections/tables. I've got the select,insert,update,delete working just fine...

But now I'd like to add Transactions to the mix and I cannot find any documentation about how to make this work. I see there is Zend\Db\Adapter\Driver\Pdo\Connection which holds the beginTransaction and commit/rollback functions.

So as a test I created a new Connection in my ServiceLayer

$connection = new Connection();
$connection->setConnectionParameters($connectionParameters); // DSN Array

// do some insert here
// do another insert
// update something


No errors but the inserts are actually inserted instead of being rolled-back.

Anyone have any documentation or a tutorial I can follow to make this work?