0

On my laptop everything works fine but when I deploy to our live test server I get:

Fatal error: Call to a member function beginTransaction() on a non-object in /var/www/html/magento82/app/code/core/Mage/Core/Model/Abstract.php on line 313

It seems to be happening when I call:

//this works fine
$scan = Mage::getModel('company_returnscans/scan');
...
//the error is here
$scan->save();

Here's my config.xml:

<global>
    <models>
        <company_returnscans>
            <class>Company_ReturnScans_Model</class>
            <resourceModel>company_returnscans_resource</resourceModel>
        </company_returnscans>

        <company_returnscans_resource>
            <class>Company_ReturnScans_Model_Resource</class>
            <entities>
                <scan>
                    <table>return_scan</table>
                </scan>
            </entities>
        </company_returnscans_resource>
    </models>
</global>

And I'm using this class:

class Company_ReturnScans_Model_Scan extends Mage_Core_Model_Abstract
{
    protected function _construct()
    {
        $this->_init('company_returnscans/scan');
    }
}

this class:

class Company_ReturnScans_Model_Resource_Scan extends Mage_Core_Model_Resource_Db_Abstract
{
    protected function _construct()
    {
        $this->_init('compnay_returnscans/scan', 'scan_id');
    }
}

and this class:

class Company_ReturnScans_Model_Resource_Scan_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
    protected function _construct()
    {
        $this->_init('compnay_returnscans/scan');
    }
}
  • please see my answer, if have any issue let me know. – Pawan Dec 14 '18 at 16:33
  • Hello @Ryan, Did you get a chance to look at my answer! – Pawan Dec 21 '18 at 4:31
0

There is typo in your class name:

$this->_init('compnay_returnscans/scan', 'scan_id'); should be

$this->_init('company_returnscans/scan', 'scan_id');

And

$this->_init('compnay_returnscans/scan'); Should be:

$this->_init('company_returnscans/scan');

Please check spelling of company, you have written compnay

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.