Magento News
Setting up a model in magento 1.5.x
I can successfully do getModel(module/licenses) but then when I load($id) things break.
My database table is setup fine called licenses.
my config file has in the global -> modules tag
<modulename>
<class>NameSpace_Module_Model></class>
<resourceModel>module_mysql4</resourceModel>
</modulename>
<modulename_mysql4>
<class>NameSpace_Module_Model_Mysql4</class>
<entities>
<licenses>
<table>licenses</table>
</licenses>
</entities>
</modulename_mysql4>
I then have a file located at my module at Model/Licenses.php which has the class NameSpace_Module_Model_Licenses extends Mage_Core_Model_Abstract and includes a construc function which does $this->_init('module/licenses')
I also have a file in my module at Model/Mysql4/Licenses.php with the class NameSpace_Module_Model_Mysql4_Model_Licenses extends Mage_Core_Model_Mysql4_Abstract with a constructor which does $this->_init('module/licenses', 'primary key here') This class never seems to be instantiated because I’ve added a var_dump exit that never seems to run
So I can get my model and dump it onto the screen but if I do a load($id) things die without warning in any log files. If I run it in a try catch i still get nothing. If I run a ->getResource() instead in a try catch and dump out the exception it gives a message that
Mage registry key “_resource_singleton/module/licenses” already exists.
So how does one properly setup a model for a table?
Setting up a model in magento 1.5.x
Possibly Related Posts:
- Database query different results
- Menu highlight in magento under admin
- magento disable a banner on certain category pages or have a banner with multiple links
- Magento, using ACL for frontend. Possible?
- Magento IE-7 Fix In Windows XP
RSS Feed