I am trying to follow


the simple report example.

I get the following error:

Fatal error: Call to a member function getReadConnection() on a non-object in /Volumes/Apache/mage/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php on line 134

I can pastebin any code you wanna see but does anyone have any idea why I'm seeing that?

  • 1
    Code from the model and resource model would be great. May 31, 2013 at 5:27

2 Answers 2


You have this? It looks like you have no resource model.


You have to define the class and the resource model.

class Super_Awesome_Model_Simple extends Mage_Core_Model_Abstract
    protected function _construct()

and the resource model:

class Super_Awesome_Model_Mysql4_Simple extends Mage_Core_Model_Resource_Db_Abstract
    protected function _construct()
        $mainTable = 'simple'; // check the node in the config.xml
        $idFieldName = 'simple_id'; // whatever the column is named.
        $this->_init($mainTable, $idFieldName)

And to be up to date change now every Mysql4 to Resource. Mysql4 is outdated. Today the resource models are named Namespace_Module_Model_Resource_MyModel

  • the only code I was missing was that last block
    – user2045
    May 31, 2013 at 9:20
  • when I added it, it gives me: "Fatal error: Class VMR_Rtest_Model_Mysql4_Simple contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Mage_Core_Model_Resource_Abstract::_getReadAdapter, Mage_Core_Model_Resource_Abstract::_getWriteAdapter) in /Volumes/Apache/mage/app/code/local/VMR/Rtest/Model/Mysql4/Simple.php on line 11" (Bear in mind, I'm using VMR_Rtest instead of that super_awesome stuff)
    – user2045
    May 31, 2013 at 9:21
  • Sorry I was wrong, you have to extend Mage_Core_Model_Resource_Abstract May 31, 2013 at 14:55
  • It just flew through my twitter stream creare.co.uk/magento-model-basics-the-complete-series May 31, 2013 at 15:21
  • where I can found these files? Jul 12, 2016 at 16:13

I was also getting the same error. When i checked by system.log of Magento, i got message

"2013-06-26T07:03:11+00:00 ERR (3): Warning: include(<Namespace>/<ModuleName>/Model/Mysql4/<FileName>.php): failed to open stream: No such file or directory in /var/www/<site-name>/lib/Varien/Autoload.php on line 93"

Then i checked in my directory that this particular file was missing. After creating the file, the issue was gone.

  • This was the issue for me too. Thanks a lot! Aug 30, 2016 at 5:41

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.