Welcome Guest, Not a member yet? Register   Sign In
MY_Model malfunctions after upgrade to CI 2.1
#1

[eluser]dblackherod[/eluser]
I had a stable system using CI 1.7.3 and HMVC 4.x

I upgraded to CI 2.0 while still maintaining HMVC 4.x and everything still worked fine.

I upgraded to HMVC 5.2 (i guess or 5.3) and everything still worked fine.

All this time, MY_Model class had no problems whatsoever.

Now, I upgrade to CI 2.1.0 and HMVC 5.4 and all my modules' model classes extending MY_Model return the fatal error 'Call to a member function on a non-object' for all $this->... calls.

What may I be doing wrong?

I have ceased to extend the base Model class (CI_Model) from MY_Model yet the problem persists.

I have also autoloaded the database library as opposed to manually loading them where I want them and the problem persists.

What do I do?

for starters I know that errors like this only show up when the library owning the property (in this case $db) isn't being loaded properly and the solution usually is to laod the required library - this prompted me to autolaod the database library and comment out all other $this->load->database() calls.

I need guidance...
#2

[eluser]PhilTem[/eluser]
I don't know the differences between HMVC 4.x and HMVC 5.3, but maybe it's something within the config? You need to set the path for the modules in the config.php-config. Maybe this will solve the problem.

Have you tried it with a new model you created? Which in a first try should extend CI_Model and then MY_Model just to ensure it's working with non-moduled models?.

Don't have any more suggestions, but set logging-threshold to 4 and read through the log. Maybe you can find some solution or problem causers there.
#3

[eluser]dblackherod[/eluser]
@PhilTem... Believe me I have tried all that you've suggested before posting the challenge and i'm still trying to wrap my head around it.

I have no idea whatsoever what the possible cause of this problem might be...
#4

[eluser]aquary[/eluser]
Have you put parent::__construct() in the MY_model?. It's the only possible cause I could think of after reading your problem.
#5

[eluser]PhilTem[/eluser]
[quote author="aquary" date="1332488000"]Have you put parent::__construct() in the MY_model?. It's the only possible cause I could think of after reading your problem.[/quote]

If you don't need a custom constructor, there is no need for calling the parent::__construct() part since it's automatically called as you extend the class. (That's what I learned from the CI forums Wink )

@dblackherod Well, I'm a little bit confused, since I don't know any other solution that might fix your problem. At least not without seeing any source code Wink (If you want to share your source code please use gist for large files. Merci)
#6

[eluser]wiredesignz[/eluser]
@dblackherod, Modular Extensions HMVC v5.4 requires that you extend module controllers from the MX_Controller class versus earlier versions using the Controller class.

@PhilTem is correct. Having a constructor which only calls the parent constructor is pointless. If a constructor is absent in the extension class then the the parent constructor will be executed by default.




Theme © iAndrew 2016 - Forum software by © MyBB