CodeIgniter Forums
HMVC Issue when loading Models - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: HMVC Issue when loading Models (/thread-11351.html)



HMVC Issue when loading Models - El Forum - 09-05-2008

[eluser]jtkendall[/eluser]
Hi, I"m hoping someone who has experience using Modular Extensions - HMVC can help me. I'm trying to load a model and it's throwing an error with the Controller ME requires. The error I'm getting is:

Quote:Fatal error: Cannot access empty property in /Library/WebServer/vhosts/cms/cms/trunk/v1.1/system/application/libraries/Controller.php on line 330

And that line is:

Code:
$this->$_alias = new $model();

I did a simple die($model) before the line and the variable has the correct class name for the model. I'm calling the model using:

Code:
$this->load->model('admin_media_model', '', true);

I've tried it in both the constructor for the controller and in the function I'm calling and both result in the error above. I've also tried moving it out of the models folder in the module and into the default models folder and got the same error.

Any help would be appreciated.

Edit:

Just read through the FAQs on this and they don't use the alias or autoconnect params. Tried it without either and autoloading via the database and it seems to be working.


HMVC Issue when loading Models - El Forum - 09-05-2008

[eluser]wiredesignz[/eluser]
Try:
Code:
$this->load->model('admin_media_model', 'admin_media_model', true);

Welcome to CI forums too.

EDIT:
The empty alias causes the error, Good luck.


HMVC Issue when loading Models - El Forum - 09-05-2008

[eluser]jtkendall[/eluser]
Thanks. I should of tried that before posting, it works.