I have been working on a simple module and have been stuck with the error
Can't retrieve entity config
for too long. I am assuming that this is to do with the way I have set my config.xml files up?
The module is to extract information from a table that I have put in to the database. I guessed this would be an easy and basic project for me but i'm really struggling.
My two questions are
- How should I go about de-bugging projects in Magento (many of my
problems have been with the xml). So far I have been usingvar_dump()
anddie()
commands, is there a better way? - How do I resolve this problem? (I have added my xml code below)
namespace/module/etc/config.xml
<global>
<models>
<prefcentre>
<class>Ps_Prefcentre_Model</class>
<resourceModel>prefcentre_mysql4</resourceModel>
</prefcentre>
<prefcentre_mysql4>
<class>Ps_Prefcentre_Model_Mysql4</class>
<entities>
<prefcentre>
<table>prefcentre</table>
</prefcentre>
</entities>
</prefcentre_mysql4>
</models>
<resources>
<prefcentre_write>
<connection>
<use>core_write</use>
</connection>
</prefcentre_write>
<prefcentre_read>
<connection>
<use>core_read</use>
</connection>
</prefcentre_read>
</resources>
</global>
======EDIT=====
Cache is disabled.
class Ps_Prefcentre_Model_Mysql4_Preferences
extends Mage_Core_Model_Mysql4_Abstract
{
protected function _construct()
{
$this->_init('prefcentre/preferences', 'prefcentre_id');
}
}
Best Answer
The error is generated in this method
Mage_Core_Model_Resource::getTableName()
. You end up in that method usually by calling the_init()
method from the collection constructor.Check how that method looks like in
Ps_Prefcentre_Model_Mysql4_Prefcentre_Collection
(something like that).It should look like this:
The first parameter (
prefcentre/prefcentre
) means the following: what's before/
represents the main model class, the name of the tag right under<models>
tag. In your case<prefcentre>
. What's after the/
is the node name underprefcentre_mysql4->entities
, and before the<table>
tag. In your case alsoprefcentre
See my comments below directly on your config file section:And make sure you clear the cache after modifying something in
config.xml