[eluser]jefc[/eluser]
I was about to post a similar question to this but found this one so thought I'd resurrect it.
I understand that being added by reference means it takes up no extra space, but it still feels messy! One way round it I have used some of the time is to assign to a local variable each time I need to use a CI resource from in a library. So instead of
Code:
$this->CI =& get_instance();
in the library constructor I am using
Code:
$CI =& get_instance();
in the necessary function. This way the variable is local to the function. However, I now have that latter line of code all over the place. Not very DRY!
My application is pretty complex, with a significant number of my own libraries, and I have various nested objects, including array of objects inside other objects. It is really useful to be able to view an object as a whole and if you see the whole CI superobject a few times in there it gets very unwieldy!
Thanks in advance for any input.