Search code examples
phpdesign-patternsmagentofactory-pattern

Name for the Strings that Define Magento Class Names


Magento uses a factory pattern for instantiating objects from classes

$model  = Mage::getModel('catalog/product'); //Mage_Catalog_Model_Product by default
$helper = Mage::helper('catalog/data');   //Mage_Catalog_Helper_Data by default

These strings are expanded into classnames, and the System can be configured to replace the default values.

What are, or should, these strings be called? I've been abusing the term URI (sometimes tempering the abuse with the phrase "URI-like"), but that's not really right. "Class Name" doesn't seem right either, as it could easily cause confusion (Are you talking about the factory class name, or the actual PHP class name?)

Anyone have any stabs at authority on this?


Solution

  • This string is called class (model, block, helper - depends from usage context) alias. Alias naming rule is: group/entity.

    Each module can define own group or define rewrites for existing one.