Help me abount transaction (begin, commit, rollback) in cakephp 3 version

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

Help me abount transaction (begin, commit, rollback) in cakephp 3 version

Somsubhra Saha
Hi,

I am coded from ref link - http://book.cakephp.org/3.0/en/orm/database-basics.html#using-transactions.
But my code is running perfectly. But data is not updated or inserted into database.

Below is my code (controller) -

$conn = ConnectionManager::get('default');

$conn->begin();
try {
   
    // here is my code //

    $conn->commit();
} catch(Exception $e) {
    // do exception handling
    $conn->rollback();
}       


When I used exit before commit line the database is updated and as well as insert values. But when the exit remove the rollback is working (I think).

Please help or guide me.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.