Welcome Guest, Not a member yet? Register   Sign In
Naming conventions for Models
#1

[eluser]omed habib[/eluser]
Hi,

Does anyone know why in some environments CI cannot detect a model file unless its all lowercase? Is there a way to toggle this feature? I built an application in my dev environment and am using CamelCase to name my models, but when I uploaded my site to my staging server it said that it could not find one of my model files. I renamed the filename to all lowercase and it worked, even though in my controller the file was still being called with its respected upper/lowercases.

Thanks!
#2

[eluser]coolfactor[/eluser]
Windows and Mac file systems are not case-sensitive by default, but Linux is. CodeIgniter documentation says to keep the first letter uppercased, but lowercase the rest of the letters. This is only important for the file name. Internally, the name of your class can be whatever you want.

I don't like CI's naming conventions, but I've learned to adapt. It's the only way to ensure operability between file systems.
#3

[eluser]coolfactor[/eluser]
Further to this, CI assigns the model instance to your controller in all lowercase. It completely ignores the case you specify when loading the model. I wish this would change, but again, it's meant to keep it simple for everyone by defining a convention.




Theme © iAndrew 2016 - Forum software by © MyBB