Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $db->beginTransaction();
- try {
- // Run an insert
- $model_record->insert(array('single_item' => 'its value'));
- // More logic, and run an update.
- $model_record->this_value = 'that';
- // Save it
- $model_record->save();
- //Commit the transaction
- $db->commit();
- } catch (Exception $e) {
- // It finds the rollback, yet does nothing.
- $db->rollBack();
- }
- $this->_db->beginTransaction();
- // This works
- $this->_db->insert('table_a',
- array(
- 'a_field' => 'transaction test',
- )
- );
- // This does not work, at all. It inserts and does not rollback. There is no commit.
- $_table_a_model->insert(
- array(
- 'a_field' => 'transaction test',
- )
- );
- $this->_db->rollback();
- $the_model = $this->_model->getAdapter();
- $the_model->beginTransaction();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement