Which one is more correct:
Mage::getResourceModel() or

I always use the first method unless I already have a model that I can call the getCollection on. I'm just wondering if there are any advantages/disadvantages to it.

2 Answers 2


The methods Mage_Core_Model_Abstract::getResource() and Mage_Core_Model_Abstract::getCollection() are just handy shortcuts if you want to get the resource model or collection for an existing model instance.

They eventually call Mage::getResourceModel(), so if you don't already have an instantiated model, the more straightforward way to instantiate a collection or resource model is to use Mage::getResourceModel() directly. The result is always the same.



Mage::getModel() will create a new instance of an object each time even such object exists in configuration.


$product1 = Mage::getModel('catalog/product');
$product2 = Mage::getModel('catalog/product');

$product1 and $product2 both have different instant of same object and also occupy different memory


As far as I know, all collections in Magento are resource models. They are instantiated by




It doesn't really matter which function you use; the latter one simply calls the first one. The Magento team simply chose to make collections part of the resource, probably because collections need to query the database a lot. Usually, you will not have to call Mage::getResourceModel() for anything else than collections.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.