Welcome Guest, Not a member yet? Register   Sign In
Need refactoring advice
#4

The only other suggestion I could make would be to configure an autoloader (like Composer), create a model which doesn't extend CI_Model, and don't use CI's loader to load the model. Then you can pass the ID to the constructor.

The downside, of course, is that you have to make sure to load the database and you'll have to copy over the magic method from CI_Model (to access the CI instance via $this) if you want to limit the amount of code you'll need to change in your model.

The upside is that you could connect directly to the right database in the model's constructor, rather than switching databases.
Reply


Messages In This Thread
Need refactoring advice - by Rashid - 10-15-2015, 06:53 AM
RE: Need refactoring advice - by mwhitney - 10-15-2015, 08:12 AM
RE: Need refactoring advice - by Rashid - 10-16-2015, 01:37 AM
RE: Need refactoring advice - by mwhitney - 10-16-2015, 07:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB