I am currently studying Magento and, in particular, about how models and ORM work.
As far as I can tell, there are models (which are real entities), Resource models (which are directly connected to the database adapter) and Collections (which are containers for storing model collections).
Why then is there a ton of code and examples that are used Mage::getResourceModel()instead of just Mage::getModel()- especially when capturing a collection, i.e. Mage::getResourceModel('catalog/product_collection').
The only reason I can see is that you Mage::getModel()will have to go through the resource model at some point, so itβs more efficient to go directly to the resource model. But isn't that a bad practice?
source
share