{"id":172,"date":"2011-12-30T00:37:41","date_gmt":"2011-12-30T06:37:41","guid":{"rendered":"http:\/\/www.evermoretechnologies.com\/blog\/?p=172"},"modified":"2011-12-30T00:37:41","modified_gmt":"2011-12-30T06:37:41","slug":"controllers-and-models-in-codeigniter-choose-names-wisely","status":"publish","type":"post","link":"https:\/\/www.evermoretechnologies.com\/blog\/2011\/12\/controllers-and-models-in-codeigniter-choose-names-wisely\/","title":{"rendered":"Controllers and Models in Codeigniter &#8211; Choose names wisely"},"content":{"rendered":"<p>Short version: Make sure you don&#8217;t name your controllers and models the same when working with Codeigniter.  Probably good practice with any programming, but I just lost 15min. trying to figure out why I got a method not found error on a model when the controller calling it had the same class name. . . oops.<\/p>\n<p>I had a model named User, a core controller class that called helper class that used that model, and a controller named User.  On that controller, I got 500 errors calling a method from my User model.  It worked fine on all my other controllers.  I removed that controller and used a profile controller I had for all user pages, and it worked like a charm.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Short version: Make sure you don&#8217;t name your controllers and models the same when working with Codeigniter. Probably good practice with any programming, but I just lost 15min. trying to&#8230; <a href=\"https:\/\/www.evermoretechnologies.com\/blog\/2011\/12\/controllers-and-models-in-codeigniter-choose-names-wisely\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/172"}],"collection":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":0,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/172\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}