Welcome Guest, Not a member yet? Register   Sign In
NTier architecture and CodeIgniter
#4

(04-19-2017, 07:37 AM)antony Wrote: The namespace solution would make it hard to use CI-related features in my models, which would be more hassle than it's worth in my opinion.

Not at all! I've done this on several past projects. I would create a new class App\BaseModel that extends \CI_Model. I would typically add common CRUD methods to that, but the point is that since it extends from CI_Model, you get all of the CI-related functionality you're used to.

Here's an example. That repo uses namespaced classes for all of it's additional functionality.

EDIT: I just realized that model doesn't actually extend CI_Model. But if you look at CI_Model, there's really only method in it that provides a hook back into the CI superobject, which got incorporated into that BaseModel. Same thing, though, just with one less layer of inheritance.

(04-19-2017, 07:37 AM)antony Wrote: Considering I'm working on a bigish personal project, I believe working with CI4 standards using a mocked framework could be better than keeping on using CI3, or using CI3 while keeping track of the divergence between CI3 and CI4 then port to 4 once it is ready to be tested.

Fair enough. If I were in your shoes I might do the same thing. But I can't officially recommend it, due to potential security issues, etc. And I do prefer a number of the features in CI4, but I'm probably the most biased person to ask Smile
Reply


Messages In This Thread
NTier architecture and CodeIgniter - by antony - 04-18-2017, 06:13 PM
RE: NTier architecture and CodeIgniter - by kilishan - 04-19-2017, 07:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB