16

What is the purpose of using these two models collection.

  1. Resource
  2. Mysql4

why can't we use resource model for all collections.

Why we are using MySql4 collection for simple module

Some one explain.

1
  • 1
    Did you manage to find an answer that covered your question?
    – Sander Mangel
    Feb 24, 2014 at 21:03

2 Answers 2

10

I would say in magento 1.8 all collections are resource collections.

Resource collections depend on generic implementations for all the SQL-stuff. the idea is to only reimplement the base class to offer support for another sql database, like postgre, oracle or mssql.

The still existing Mysql4 classes are only for backwards compatibility but only extend the resource collection

Update:

Could you tell me what are the three type of models in magento ?

I'm not sure about this, but I would say you are maybe talking about Models (extending Mage_Core_Model_Abstract), Resource Models (extending Mage_Core_Model_Resource_Db_Abstract) and Collections (extending Mage_Core_Model_Resource_Db_Collection_Abstract).

2
  • Could you tell me what are the three type of models in magento ?
    – VijayS91
    Feb 20, 2014 at 9:25
  • Updated the answer. Feb 20, 2014 at 9:35
9

Mysql4 was deprecated after Magento CE 1.6. This answer gives some more information about it. A bit more lengthy explanation can be found in this PDF.

Still, using Mysql4 classes shouldn't be an issue since it should be backwards compatible.

2
  • Bummer the PDF link no longer available.
    – philwinkle
    Jul 15, 2016 at 13:30
  • It looks like the Magento RDBMS Guide is depreciated. A little but of searching doesn't turn up much as far as reliable (or legal???) copies of it. So if it's old, remove it. Don't replace it.........
    – circlesix
    Jul 30, 2016 at 17:52

Your Answer

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

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