Hello friends,
you might have come across the situation when you have to create a simple table as well as an eav table in your module and we are confused how to give two resource models...
There is a very simple solution to this which i am going to discuss here.
Now let us have a look at our config.xml.
in global section, have a look.
<global>
<models>
<modulename>
<class>namespace_modulename_Model</class>
<resourceModel>modulename_mysql4</resourceModel>
</modulename>
<modulename_mysql4>
<modulename_eav>
<class>namespace_modulename_Model_Eav</class>
<resourceModel>modulename_eav_mysql4</resourceModel>
</modulename_eav>
<modulename_eav_mysql4>
<class>namespace_modulename_Model_Eav_Entity</class>
<entities>
<tag>
<table>table name here</table>
</tag>
</entities>
</modulename_eav_mysql4>
</models>
<global>
here as you can see i have created <modulename_eav> tag for eav model so we can declare a new resource class here. thus we solve the problem.
for any further assistance please contact me. i will be more than happy to assist.
Thanks.
you might have come across the situation when you have to create a simple table as well as an eav table in your module and we are confused how to give two resource models...
There is a very simple solution to this which i am going to discuss here.
Now let us have a look at our config.xml.
in global section, have a look.
<global>
<models>
<modulename>
<class>namespace_modulename_Model</class>
<resourceModel>modulename_mysql4</resourceModel>
</modulename>
<modulename_mysql4>
<class>namespace_modulename_Model_Mysql4</class>
<entities>
<tag>
<table>table name here</table>
</tag>
</entities>
</modulename_mysql4>
<modulename_eav>
<class>namespace_modulename_Model_Eav</class>
<resourceModel>modulename_eav_mysql4</resourceModel>
</modulename_eav>
<modulename_eav_mysql4>
<class>namespace_modulename_Model_Eav_Entity</class>
<entities>
<tag>
<table>table name here</table>
</tag>
</entities>
</modulename_eav_mysql4>
</models>
<global>
here as you can see i have created <modulename_eav> tag for eav model so we can declare a new resource class here. thus we solve the problem.
for any further assistance please contact me. i will be more than happy to assist.
Thanks.