EAV Resource Models

In Magento, resource model classes that rely on the EAV model are required to extend from Mage_Eav_Model_Entity_Abstract. 

If you instead extend from the standard model (Mage_Core_Model_Abstract) you’ll end up with an error such as this:

Resource is not set.
#0 Abstract.php(136): Mage::throwException('Resource is not...')
#1 Abstract.php(225): Mage_Core_Model_Abstract->_getResource()
#2 Abstract.php(225): Mage_Core_Model_Abstract->load(Object(MyModule_ComplexWorld_Model_Eavblogpost), 1, NULL)
#3 IndexController.php(10): Mage_Core_Model_Abstract->load(1)
#4 Action.php(419): MyModule_Complexworld_IndexController->indexAction()
#5 Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#6 Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#8 Mage.php(683): Mage_Core_Model_App->run(Array)
#9 index.php(87): Mage::run('', 'store')
#10 {main}

Here is the code that generated this error:


class MyModule_Complexworld_Model_Resource_Eavblogpost

extends Mage_Core_Model_Abstract

//This should be Mage_Eav_Model_Entity_Abstract




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s