[eluser]Unknown[/eluser]
I'm starting to implement the Transactions Library, and would like to know if transactions can be 'transferred' between models. I know this works:
Code:
$this->db->trans_start();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->query('AND YET ANOTHER QUERY...');
$this->db->trans_complete();
But would this work if I call trans_start() and trans_stop() in a controller, and then the actual queries run inside models?
Code:
$this->db->trans_start();
$this->model1->random_db_insert_function_A('data');
$this->model2->random_db_insert_function_B('data');
$this->db->trans_complete();
If not, could I somehow tag each of the database queries as part of a set that is defined in the controller? Thanks for your thoughts.