[eluser]pocketmax[/eluser]
Does ci have a factory pattern? For those of you who don't know a factory pattern is a design pattern where one object/class takes in the configuration of an object and instantiates objects and returns them based on the config that was given. So for example...
$mynewobj = ci::Factory(array('type'=>'contact','fname'=>'bob'));
The factory class takes in a config array and determines the obj it should make is a contact and simple returns it. I've used them in the past but what I mainly need is a factory that keeps track of the objects it makes and there ids so it is to not duplicate an object unnecessarily. So for example...
$mynewobj = ci::Factory(array('type'=>'contact','id'=>'123'));
//since the factory already made a contact object with the same id, it won't make another and will simply return the other object as a reference.
$myotherobj = ci::Factory(array('type'=>'contact','id'=>'123'));
This has helped SSSOOOO much in the past and I think it is vital in every framework to keep track of this stuff. Logically, it makes sense. If I had two objects pointing to the same data and I made a change to one objects attribute, the other object would never know.