This is a code snippet from app/code/core/Mage/Catalog/etc/config.xml
.
<config>
..............
<global>
<models>
<catalog>
<class>Mage_Catalog_Model</class>
<resourceModel>catalog_resource</resourceModel>
</catalog>
<catalog_resource>
<class>Mage_Catalog_Model_Resource</class>
<deprecatedNode>catalog_resource_eav_mysql4</deprecatedNode>
<entities>
<product>
<table>catalog_product_entity</table>
</product>
................
</config>
We can create Mage_Catalog_Model_Porduct object as
$model = Mage::getModel('catalog/product');
Same way can create the resource model object as follows.
$resourceModel = Mage::getModel('catalog_resource/product');
I know basically there's already a function as Mage::getResourceModel();
.
Example: Mage::getResourceModel('catalog/product');
But this way is also works fine.
Can anyone explain why not using Mage::getModel()
to get the resource model object ? Any suggestions will be appreciated.