Problem class objects and CI object |
[eluser]bramb79[/eluser]
Anyone can offer me some advise on the following: I am working on a project where I want to set my up data objects along the line of http://ellislab.com/forums/viewthread/49403/P15/#239838. So I have a for example: Code: class Usermodel extends MY_Model { I can then create an instance of a User (new User()), put some values in the User object, for example a "name", and then call $this->getName() on the User object to return me the username (in an appropriate format). I also want to be able to reference other models and functions from within the CI object. For the User example that would probably mean something like: Code: $this->CI->load->model('groupmodel'); Now my problem is, is that as soon as I load the CI object in the User class, in MyClass or extend MyClass with Model (which it is most related too), the CI object (which is quite large) becomes part of the class. When I create a new instance of that class. For example: Code: $user = new User(); Code: $this->CI =& get_instance(); Code: $CI =& get_instance(); Anyone can help me with a better solution. Your help would be much appreciated. Thanks. |
Messages In This Thread |
Problem class objects and CI object - by El Forum - 08-12-2008, 10:21 AM
Problem class objects and CI object - by El Forum - 08-12-2008, 03:16 PM
Problem class objects and CI object - by El Forum - 08-13-2008, 03:26 AM
|