Ricardo Casares Mon Oct 24 16:20:38 -0400 2011

Subject: Transactions

Hello guys I'm having some bad time with transactions, and it seems they're not well documented, just found 1 post in this forum.

Can you give a nice example of using transactions in my controllers, I'm using CodeIgniter.

Thank you!

Beau Beauchamp Mon Oct 24 19:58:53 -0400 2011


You should not have a transaction occurring within your controller. That is the wrong place for these. Your transactions should be taking place within your MODELS. Thin controllers, FAT models is the proper way to build these. My understanding is that AR already wraps updates and saves in transactions.

Here's some additional info: http://www.phpactiverecord.org/docs/ActiveRecord/Model#methodtransaction