Welcome Guest, Not a member yet? Register   Sign In
Transactions between models
#1

[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.
#2

[eluser]Mauricio de Abreu Antunes[/eluser]
Controll your transactions in your controllers.
Transcations are independents of models.
#3

[eluser]Aken[/eluser]
Create a test area and try it.




Theme © iAndrew 2016 - Forum software by © MyBB