CodeIgniter Forums
Problem when to load library in model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Problem when to load library in model (/showthread.php?tid=64449)



Problem when to load library in model - carlos.vv - 02-21-2016

Hi!

In the file autoload.php the var $autoload['libraries'], I load a library generated by me, the name of this library is datetime. In a model I try to load this library ($this->datetime), If it worked in Codeigniter 2.x, but in Codeigniter 3 not working, the var $this in the model execute el magic method.

What I have to do to access the library from the model?

Thanks.

Carlos V


RE: Problem when to load library in model - includebeer - 02-27-2016

(02-21-2016, 04:15 AM)carlos.vv Wrote: What I have to do to access the library from the model?

Nothing has change in CI3, it should work the same way as in CI2. Double check all the steps to migrate from CI2 to CI3. Something must be wrong (UCfirst filename perhaps?)


RE: Problem when to load library in model - skunkbad - 02-27-2016

Just a thought. Since PHP already has a Datetime class , maybe naming a class with the same name is bad. Does it work if you rename it?