Magento class naming

so in my config file, i have following :

Anru_NZRegion_Helper

pay attention to “Anru_NZRegion_Helper”, “NZR” 3 letters are upper case.

in helpers’ Data file, i have Anru_NZRegion_Helper_Data class. and Magento complains about no class found.

This is because of Magento tried to explode “Anru_NZRegion_Helper” into 3 different parts, then join those parts back, and upper casing each part’s first letter, so class name becomes
“Anru_Nzregion_Helper”.

Also, Magento use Anru_NZRegion as a folder name to auto – include class.

there was a bug wasted so many of mine time, because In my home computer , my Mangento is installed on a vagrant machine, and on a shared folder, and my host machine is windows, which means folder name is case – insensitive. but Linux is case-sensitive.

initially, I had this Anru_Nzregion_Helper , in linux it becomes “Anru/Nzregion” folder name
and worked on my local machine but failed on my linux host.

  1. Leave a comment

Leave a comment