How can i use mysql transaction in cakephp (Without using saveAll() method)? i am using cakephp version 1.2 i have searched a lot but did not get any good exam开发者_C百科ple If anyone knows please help me thanks in advance ...
Here's a blog post with examples : http://monmonja.com/blog/2008/07/transaction-on-cakephp-12/
I recommend you upgrade to 1.3 though. CakePHP 2.0 will be coming out soon. The manual entry for 1.3 is here : http://book.cakephp.org/view/1633/Transactions
UPDATE
CakePHP 2.0 is also similar - http://book.cakephp.org/2.0/en/models/transactions.html
$dataSource = $this->getDataSource();
$dataSource->begin();
// Perform some tasks
if (/*all's well*/) {
$dataSource->commit();
} else {
$dataSource->rollback();
}
精彩评论