Welcome Guest, Not a member yet? Register   Sign In
Is it possible to UNLOAD a model?
#9

[eluser]Aken[/eluser]
There really is no efficient way to replace a model name that's attached to the CI super object currently built into CodeIgniter. In response to the original post (even though it's old) - if you have two different models with two different functions, I don't see why you'd want to use the same alias for those separate models anyway. I think it's a good way to confuse yourself (and maybe others) down the road.

Personally, instantiating is the best way to handle either multiple instances of the same model, or the replacement of one model for the next in the same variable. Then you don't have to argue with CI's loader class and its settings, and you can make use of unset() and whatnot.

As for an unload() method on the loader, that'd be the opposite of impossible - quite easy actually. You could consider that an option for your application if you felt it was necessary. Extending the loader class is easy. The methods behind it wouldn't unload the class from PHP, it would basically run unset() on CI variables to remove the model like it was never there in the first place. Pretty much the same thing as what Nameless One posted.


Messages In This Thread
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 10:38 AM
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 11:51 AM
Is it possible to UNLOAD a model? - by El Forum - 11-16-2007, 12:44 PM
Is it possible to UNLOAD a model? - by El Forum - 11-17-2007, 03:59 AM
Is it possible to UNLOAD a model? - by El Forum - 04-01-2009, 10:01 AM
Is it possible to UNLOAD a model? - by El Forum - 10-17-2009, 11:02 PM
Is it possible to UNLOAD a model? - by El Forum - 10-18-2009, 07:17 AM
Is it possible to UNLOAD a model? - by El Forum - 02-17-2012, 06:42 PM
Is it possible to UNLOAD a model? - by El Forum - 02-18-2012, 02:53 AM
Is it possible to UNLOAD a model? - by El Forum - 02-20-2012, 12:12 PM
Is it possible to UNLOAD a model? - by El Forum - 02-20-2012, 01:00 PM
Is it possible to UNLOAD a model? - by El Forum - 07-12-2013, 07:08 PM
Is it possible to UNLOAD a model? - by El Forum - 07-31-2013, 09:21 PM
Is it possible to UNLOAD a model? - by El Forum - 07-31-2013, 09:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB