CI and var scope - problems - 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: CI and var scope - problems (/showthread.php?tid=45841) |
CI and var scope - problems - El Forum - 10-08-2011 [eluser]mestresan[/eluser] Hi guys, I am with a problem/ doubt about how to use CI correctly... I'll explain with a simple example. I have 2 classes / models. The first like example: Code: class Class1_model extends CI_Model Now, I have another class, that contain one var that is object from Class1; Code: class Class2_model extends CI_Model Fine... class2 working alone.. Now, in my controller I need create one object model from class1... OK. I load the model and populate with get and sets. The problem: In same controller, I call second class/model, and.... the content from class1 loaded before, disappears! CI doesn't respect the scope !! This is a simple example, but I use CI for more advanced class... and have many problems with scope I am used similar classes in Java and .NET, and I have no problems. Someone have any tips? thanks |