[eluser]zauber[/eluser]
oooh, tonanbarbarian - that looks brilliant! Do you by chance have references to more 'tricked-out' extended loaders? (curious cause I'm trying to learn
)
I'm thinking you could perhaps do something similar, but using function __call($modelname,$args){...} instead of specifically function treemodel($args){...}, that way I'm guessing I won't have to append stuff to the loader for each abstract class I write - I could instead do:
$this->load->model("AbstractestModel");
$this->load->abstractestmodel("FuzzyModel");
$this->load->fuzzymodel("ConcreteModel");
sure, it's not as nice as just going $this->load->model("ConcreteModel") and have the inheritance work perfectly, but it's a sight better.
But come to think of it.... if I do the above, I need to know in my head the inheritance scheme. And if I know it already, I guess I could always write:
$this->load->model("AbstractestModel",DONTCONSTRUCT);
$this->load->model("FuzzyModel", DONTCONSTRUCT);
$this->load->model("ConcreteModel",CONSTRUCT);
(or whatever the syntax for toggling initialization is)
It makes less obvious semantic sense, but is almost as easy to write and doesn't require an extension of the loader. I like your approach better, although it feels like I should only use it for really extending CI with an entirely new type of Model, rather than just for code reuse, since It's an extension of a core class.
Also, do you have any idea of how to solve the path-problem if I'd prefer to keep abstract models outside the application directories?
Thanks again for the inspiring feedback.