Transactions in CakePHP


In found out that there are many options you can use in dealing with transaction in CakePHP.

First you have the option to use saveAll
Practical use of saveAll part 1
Practical use of saveAll part 2
Saving your data

Second you can manually start the transaction
Transaction in CakePHP 1.2

Third you can also use a behavior
Transaction Behavior

But it is advisable to use saveAll next the Transaction Behavior, and next manually starting the transaction.

By the way just a note for example you have a scenario like this
You have a code like this $this->employee->query($query); inside a transaction and the $query contains updates for the department model and also for the employee model when I use $this->employee->rollback(); will it rollback both models

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: