Is it possible to rollback a transaction after it has been commited?
I ask this because in the Datamapper documentation i see the trans_begin()
method, but i didn't find the trans_end()
method. Codeigniter has the trans_complete()
method, so i assumed Datamapper might have a similar method.
One thing I found interesting is this answer. Is there anything similar to a savepoint in Datamapper/Codeigniter?
This means that instead of:
You'd use:
Everything else, according to the Datamapper documentation, is identical to Codeigniter in regards to transactions. If you look at the source code for the Datamapper library, you'll see that all
trans_*()
calls are simply wrapper functions. Example:A
trans_end()
method does not exist in either Codeigniter or Datamapper. You'd usetrans_start()
andtrans_complete()
for automatic transactions, or to call them manually:Just replace
$this->db
with your Datamapper object. For example.