0

I attempt to call a resourceModel, however, I only recieve a white screen and the following error message within my log:

Warning: include(Namespace/ProjectName/Model/Mysql4/Projectname.php): failed to open stream: No such file or directory

This is how i'm calling the above:

Mage::getResourceModel('projectname/projectname')->uploadData();

This is how the resourceModel is defined in the config.xml:

<models>
    <projectname>
        <class>Namespace_ProjectName_Model</class>
        <resourceModel>projectname_mysql4</resourceModel>
     </projectname>
....
</model>

And finally, this is the resourceModel itself:

class Cjponyparts_ProjectName_Model_Mysql4_ProjectName extends Mage_Core_Model_Mysql4_Abstract{
    ....
    function uploadData(){....}
}

The resourceModel is located at:

Namespace/ProjectName/Model/Mysql4/ProjectName.php

The only difference I see that could cause this error is that I have the resourceModel defined as like this "ProjectName.php" while it looks for something like this "Projectname.php". Is this the problem? How can I fix? Do resourceModels need to be defined as the second option?

  • Try Mage::getResourceModel('kitinventory/projectname') – Renon Stewart Mar 16 '15 at 18:08
  • @R.S derp, that was the projectname initially before I removed it :D it should (and does) read 'projectname/projectname'. – easymoden00b Mar 16 '15 at 18:09
  • 1
    Try change ProjectName.php to Projectname.php and update the class accordingly \ – Renon Stewart Mar 16 '15 at 18:11
  • 1
    or Mage::getResourceModel('kitinventory/projectName') – Renon Stewart Mar 16 '15 at 18:11
1

if you take a look at the error message

Warning: include(Namespace/ProjectName/Model/Mysql4/Projectname.php): failed to open stream

Failed to open Projectname.php

Try change the class and file name to not be camel-case

Namespace/ProjectName/Model/Mysql4/Projectname.php

class Cjponyparts_ProjectName_Model_Mysql4_Projectname extends Mage_Core_Model_Mysql4_Abstract{
    ....
    function uploadData(){....}
}

Mage::getResourceModel('kitinventory/projectname')

If you want to keep the name camel case try

Mage::getResourceModel('kitinventory/projectName')

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.