Welcome Guest, Not a member yet? Register   Sign In
Extending Main model and not the CI Model
#5

Quote:
(10-12-2015, 07:42 AM)JayAdra Wrote:
(10-12-2015, 02:12 AM)slax0r Wrote: Loading the main model in the constructor will not work, because the constructor will not be executed due to a fatal error of "Main_model" class not found. What you could do is put the main model into the autoloader, but it seems stupid(ish) to have a useless main model object instantiated for nothing.

Why don't you create a MY_Model in application/core and have your models extend from that? That's what it was meant to be used for. And yes, it is ok to extend in such way, and will of course work, those are basics of OOP.

Yes, true - I didn't realise he was using Main_model instead of MY_Model - glazed over that one.


This is true, I can not call the "$this->load->model('...')" in my constructor because it was not defined yet.

Anyway, thanks for the quick reply. I just found out that I can create a customized model like 'MY_Model'.

God bless and more power!
Reply


Messages In This Thread
RE: Extending Main model and not the CI Model - by lazyfox - 10-12-2015, 08:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB