I am trying to pull data from a table. To do this I have used
mage::getModel('module/model')->getData
this has returned an empty array, but i can't work out why as the table i am calling holds data.
There is a discrepancy between this model
class Ps_Prefs_Model_Prefsformelements
extends Mage_Core_Model_Abstract
{
protected function _construct()
{
$this->_init('ps_prefs/prefsformelements');
}
}
class Ps_Prefs_Model_Resource_Prefsformelements
extends Mage_Core_Model_Resource_Db_Abstract
{
protected function _construct()
{
$this->_init('ps_prefs/prefsformelements', 'idform_elements');
}
}
class Ps_Prefs_Model_Resource_Prefsformelements_Collection
extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
protected function _construct()
{
$this->_init('ps_prefs/prefsformelements');
}
}
and other models in my module. That descripency lies in the namespace_module/...
part of the call. as you can see this model uses namespace_module/...
while my other models work fine with just module/...
I have tried run the above code using just module/...
but I get the error can't retrieve entity config
but if I try to run the other using this namespace_module/...
I start throwing errors why?
I had considered my config but if that is the case why am I not getting errors when I use namespace_module/...
and why wont it work when I make it conform to the other models?
===
EDIT
===
<config>
...
<global>
<models>
<prefs>
<class>Ps_Prefs_Model</class>
<resourceModel>prefs_resource</resourceModel>
</prefs>
<prefs_resource>
<class>Ps_Prefs_Model_Resource</class>
<entities>
<prefs>
<table>prefcentre</table>
</prefs>
<prefsemail>
<table>prefcentre_options</table>
</prefsemail>
<prefsform>
<table>pref_form_elements</table>
</prefsform>
</entities>
</prefs_resource>
</models>
...
</global>
...
</config>
load
beforegetData
?Mage::getModel('module/model')->load(3)->getData();
– Marius♦ Nov 1 '13 at 14:03function load() on a non-object
. What is wrong with the code for the model? – tony09uk Nov 1 '13 at 14:18config.xml
section where the models are defined. Everything between<models></models>
– Marius♦ Nov 1 '13 at 14:19Mage::getModel('prefs/something_here')->load(3)
. Make sure the classPs_Prefs_Model_Something_Here
exists. – Marius♦ Nov 1 '13 at 14:26mage::getModel('prefs/prefsformelements')
to call the model and I have three files for it, the model, the resource model and the collection, which are what I've post above. could the discrepancy I mentioned have anything to do with the problem? – tony09uk Nov 1 '13 at 14:35