php - Loading a resource model in Magento- failed to open file -
i trying ues resource model , following when try load it:
warning: include(mage\core\resource\model.php): failed open stream: no such file or directory in c:\xampp\htdocs\magento\lib\varien\autoload.php on line 93
my controller action looks like:
$blogpost = mage::getmodel("test/blogpost"); $blogpost->load(1);
my config.xml
looks like:
<?xml version="1.0"?> <config> <modules> <lock_test> <version>1.0.0</version> </lock_test> </modules> <global> <models> <test> <class>lock_test_model</class> <resourcemodel>test_resource</resourcemodel> </test> <test_resource> <class>lock_test_model_resource</class> </test_resource> </models> </global> <frontend> <routers> <lock_router> <use>standard</use> <args> <module>lock_test</module> <frontname>test</frontname> </args> </lock_router> </routers> </frontend> </config>
i have no idea why trying load mage
directory. can't see wrong config file.
i'm loosly following this tutorial, although haven't created entities , table name above, think should still find resource model.
please help!
app\code\local\lock\test\model\blogpost.php
like:
<?php class lock_test_model_blogpost extends mage_core_model_abstract { protected function _construct() { $this->_init("test/blogpost"); } }
app\code\local\lock\test\model\resource\blogpost.php
looks like:
<?php class lock_test_model_resource_blogpost extends mage_core_resource_model { protected function _construct() { $this->_init("test/blogpost", "blogpost_id"); } }
the problem in resource model
class lock_test_model_resource_blogpost extends mage_core_resource_model
there no such class mage_core_resource_model, why magento tries find him in mage\core\resource\model.php. want extend mage_core_model_resource_db_abstract.
Comments
Post a Comment