July 2015
Beginner to intermediate
260 pages
5h
English
Magento makes use of factory methods to instantiate models, helpers, and block classes. A factory method is a design pattern that allows us to instantiate an object without using the exact class name and using a class alias instead.
Magento implements the following factory methods:
Mage::getModel()Mage::getResourceModel()Mage::helper()Mage::getSingleton()Mage::getResourceSingleton()Mage::getResourceHelper()Each of these methods takes a class alias that is used to determine the real class name of the object that we are trying to instantiate. For example, if we want to instantiate a product object, we can do so by calling the getModel() method:
$product = Mage::getModel('catalog/product'); Notice that we are passing a factory ...
Read now
Unlock full access