Which one is more correct:
Mage::getResourceModel() or
Mage::getModel('catalog/product')->getCollection()
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.
Best Answer
The methods
Mage_Core_Model_Abstract::getResource()
andMage_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 useMage::getResourceModel()
directly. The result is always the same.