<global>
<models>
<starmall_shipment>
<class>Starmall_Shipment_Model</class>
<resourceModel>starmall_shipment_mysql4</resourceModel>
</starmall_shipment>
<starmall_shipment_mysql4>
<class>Starmall_Shipment_Model_Mysql4</class>
<entities>
<shipment>
<table>starmall_shipment</table>
</shipment>
</entities>
</starmall_shipment_mysql4>
</models>
</global>
我在后端的自定义网格正在工作,我看到了其中包含数据的网格。
作为调试测试,我在 Grid.php 中_prepareCollection
:
$x = Mage::getModel('starmall_shipment/shipment');
$x->load(3);
var_dump($x); // WORKS and I get information
当我在独立脚本中运行它时:
<?php
define("MAGE_BASE_DIR", "/home/users/xxx/xxx");
require_once MAGE_BASE_DIR . '/app/Mage.php';
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$x = Mage::getModel('starmall_shipment/shipment');
$x->load(3);
var_dump($x);
?>
我看到这个错误:
No such file or directory in /home/users/xxx/xxx/lib/Varien/Autoload.php
Failed opening 'Mage/Starmall/Shipment/Model/Shipment.php'
为什么要Mage
放在模型前面?我的配置有什么问题?
附加信息:
/app/etc/Starmall_Shipment.xml
<config>
<modules>
<Starmall_Shipment>
<active>true</active>
<codePool>local</codePool>
</Starmall_Shipment>
</modules>
真正的问题(可能)
我的 Magento 托管服务提供商/app/etc/local.xml
在安装 Magento 时将此标签设置为默认 int。
<cache>
<backend>memcached</backend>
<memcached>
<servers>
<server>
<host>unix:///path/to/memcached.sock</host>
<persistent>0</persistent>
<port>0</port>
</server>
</servers>
</memcached>
</cache>
如果我注释掉这个标签,那么我不需要loadModules()
在我的脚本中使用。
我想知道在进入生产模式时是否需要重新打开它?