CodeIgniter Forums
Call another model method within a transaction - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Call another model method within a transaction (/showthread.php?tid=60271)



Call another model method within a transaction - El Forum - 02-20-2014

[eluser]kamikaz[/eluser]
Hi,

I'm facing an issue : is it possible to call a model function in an other model (yes we can but is it a good way ?) but within the same transaction ?

I explain myself:
Code:
<?php
class Model1 extends CI_Model
{
    //some code
    function function1()
    {
         $this->load->model('model2');
         $this->db->trans_start();
             $this->get_db_info();  //happens in transaction        
             $this->model2->get_db_info(); //doesn't happen in transaction
         $this->db->trans_complete();
    }
}

Do you have an idea how to deal with this ?
Thank you


Call another model method within a transaction - El Forum - 02-24-2014

[eluser]kamikaz[/eluser]
Anybody ?


Call another model method within a transaction - El Forum - 03-03-2014

[eluser]kamikaz[/eluser]
Still nobody ? It's very annoying Smile