(12-02-2014, 06:48 AM)dmyers Wrote: Rufnex is correct, just as a side note thou:
You would of course use $this->load->library('PlainObject'); to load this class and of course this would automatically attach it to the CI super object as a singleton. $this->plainobject->method(); etc...
If you need to create multiple "plain objects". You can then always $foo = new plainobject(); after callingĀ $this->load->library('PlainObject');
because of course $this->load->library('PlainObject'); already loaded the class.
You of course have the singleton still attached to the super object thou.
Am I to understand that simply loading a class definition results in a controller attempting to instantiate the object? That seems strange to me. What if the object requires arguments to a constructor? What if you
don't want a property attached to the controller? Also, what if the object is in fact an abstraction that serves as an ActiveRecord interface for a database? Might such classes belong in the model directory?