Why can I use double colon to invoke model function directly in CI? |
[eluser]nlsdnm[/eluser]
This is so weird...I was trying to make my codes more ORM style (without an actual ORM). Code: class User extends CI_Model { search_by_email is not a static function right? This is my controller class: Code: class Application extends CI_Controller { It is weird because, if I add static to my model function...the server crashes. If I don't load my model in controller's construct function, the server crashes. Even if I create this model function: Code: public static function search_by_email($email) { This still doesn't work at all. Can anyone explain this phenomenon? It's not really a problem..I'm glad I can even instantiate a model in my controller class..but I'm just curious how does this happen?
[eluser]Zack K.[/eluser]
I don't see why you would try and use colons as you have to call everything in codeigniter threw codeigniter... This, Code: class Application extends CI_Controller { should be, Code: class Application extends CI_Controller {
[eluser]nlsdnm[/eluser]
[quote author="Zack K." date="1380211543"]I don't see why you would try and use colons as you have to call everything in codeigniter threw codeigniter... This, Code: class Application extends CI_Controller { should be, Code: class Application extends CI_Controller { Yes...I know the standard way of doing this...but the CodeIgniter's way is quite dated right? I just want to make it more modern..even more OOP style..the better way for me to do this..I assume is to use Code: $userHandler = new User(); |
Welcome Guest, Not a member yet? Register Sign In |