Welcome Guest, Not a member yet? Register   Sign In
Where to put plain object classes?
#39

(This post was last modified: 01-05-2015, 01:13 PM by sneakyimp.)

(01-02-2015, 01:26 PM)mwhitney Wrote: That error should not occur if you use $this->load->model(), but it will probably occur if you load the model some other way (such as via an external autoloader). If you intend to autoload the class, it probably shouldn't extend CI_Model.
Unless I take care to also autoload CI classes too, as ivantcholakov's class does

(01-02-2015, 01:26 PM)mwhitney Wrote: As for the rest, it's simply a different way of writing code. I understand the desire to not have $this cluttered with everything which might be loaded by CI, but it can certainly be convenient in some cases. There's nothing stopping you from creating models which don't extend CI_Model (or even a base model which doesn't extend CI_Model), but you do have to remember that when you extend the CI classes you may be requiring the use of CI's loader for your classes.
I certainly agree that the default/native means of loading classes with CI is a certain way of writing code. I just thought that some of the early answers to the original question "where to put plain object classes?" were a bit oversimplified. I like that CI is lightweight and doesn't force you to use all of its features. I personally am still wondering how one determines which classes go into libraries and which classes go into models.
Reply


Messages In This Thread
Where to put plain object classes? - by geekita - 12-02-2014, 05:51 AM
RE: Where to put plain object classes? - by sneakyimp - 01-05-2015, 01:12 PM
RE: Where to put plain object classes? - by Jamie - 01-06-2015, 05:18 AM
RE: Where to put plain object classes? - by Jamie - 01-06-2015, 03:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB