1

I am trying to create an entity model along with creating table in setup script

but i am getting following error while running my setup script: setup script giving error:Can't retrieve entity config account/account

Below is my model part of config.xml

Bank_Account_Model bank_account_resource

        <bank_account_resource>
            <class>Bank_Account_Model_Mysql4</class>
            <entities>
                <account>
                        <table>customer_account</table>
                </account>
            </entities>
        </bank_account_resource>
    </models>    
  • put entire model configuration here. Mean while try to get your table like getTable(bank_account/account) – Rajeev K Tomy Sep 18 '14 at 9:49
0

Solution

How call a table in setup file using below code:

If you have stay with your code then try $this->getTable(bank_account/account) .it should like $this->getTable('yourmodeltype/entities')

Also.need check below thing:

Check in config.xml

<models>
            <modelstype> <!-- need to change to bank_account to bankaccount>
                <class>Bank_Account_Model</class>
                <resourceModel>modelstype_resource</resourceModel>
            </modelstype>

    <modelstype_resource> <!-- need to change to bank_account to bankaccount>
            <class>Bank_Account_Model_Mysql4</class>
            <entities>
                <account>
                        <table>customer_account</table>
                </account>
            </entities>
        </modelstype_resource>

Also you need to set resource setup and add below code under <global> tag

<resources>
        <modelstype_setup>
            <setup>
                <module>Bank_Account</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </modelstype_setup>
        <modelstype_read>
            <connection>
                <use>core_read</use>
            </connection>
        </modelstype_read>
        <modelstype_write>
            <connection>
                <use>core_write</use>
            </connection>
        </modelstype_write>
    </resources>
  • My entire module is working fine but it is not taking entity config i.e account/account the problem is only with when i try to call entity model table using $this->getTable('account/account'); It reads my setup script very well – user6506 Sep 18 '14 at 9:44
  • 1
    if you have stay with your code then try $this->getTable(bank_account/account) .it should like $this->getTable('yourmodeltype/entities') – Amit Bera Sep 18 '14 at 9:51
  • (y) cool that is what i am looking for Thanks amit bera :) – user6506 Sep 18 '14 at 10:03
  • kia na bhai please check – user6506 Sep 18 '14 at 10:45
  • what is mean by it? – Amit Bera Sep 18 '14 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy