我在清除setOrder('id_celebes','asc')后尝试粉碎Lesson3_Test_Model_Mysql4_Test和Lesson3_Test_Model_Mysql4_Test_Collection;但是没有检测到错误.______________但是如果我在清除setOrder('id_celebes','asc')后粉碎了Lesson3_Test_Model_Test;我找到了错误页面
<?php
class Lesson3_Test_Block_Monblock extends Mage_Core_Block_Template
{
public function methodblock()
{
$retour='';
/* we are doing the query to select all elements of the celebes table (thanks to our model lesson3/test and we sort them by id */
$collection = Mage::getModel('lesson3/test')->getCollection()->setOrder('id_celebes','asc');
/* then, we check the result of the query and with the function getData() */
foreach($collection as $data)
{
$retour .= $data->getData('name').' '.$data->getData('surename').' '.$data->getData('phone').'<br />';
}
//i return a success message to the user thanks to the Session.
Mage::getSingleton('adminhtml/session')->addSuccess('Congratulation !!');
return $retour;
}
}
<?xml version="1.0"?>
<config>
<modules>
<Lesson3_Test>
<version>1.0.0</version>
</Lesson3_Test>
</modules>
<frontend>
<routers>
<lesson3>
<use>standard</use>
<args>
<module>Lesson3_Test</module>
<frontName>lesson3</frontName>
</args>
</lesson3>
</routers>
<layout>
<updates>
<lesson3>
<file>lesson3.xml</file>
</lesson3>
</updates>
</layout>
</frontend>
<global>
<blocks>
<lesson3>
<class>Lesson3_Test_Block</class>
</lesson3>
</blocks>
<models>
<lesson3>
<class>Lesson3_Test_Model</class>
<resourceModel>Lesson3_mysql4</resourceModel>
</lesson3>
<lesson3_mysql4>
<class>Lesson3_Test_Model_Mysql4</class>
<entities>
<test>
<table>celebes</table>
</test>
</entities>
</lesson3_mysql4>
</models>
<!-- allow the plugin to read and write -->
<resources>
<!-- connection to write -->
<lesson3_write>
<connection>
<use>core_write</use>
</connection>
</lesson3_write>
<!-- connection to read -->
<lesson3_read>
<connection>
<use>core_read</use>
</connection>
</lesson3_read>
</resources>
</global>
</config>
<?php
class Lesson3_Test_Model_Test extends Mage_Core_Model_Abstract
{
protected function _construct()
{
parent::_construct();
$this->_init('lesson3/test');
}
}
<?php
class Lesson3_Test_Model_Mysql4_Test extends Mage_Core_Model_Mysql4_Abstract
{
protected function _construct()
{
$this->_init('lesson3/test', 'id_celebes');
}
}
<?php
class Lesson3_Test_Model_Mysql4_Test_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
protected function _construct()
{
parent::_construct();
$this->_init('lesson3/test');
}
}
答案 0 :(得分:0)
我在config
上发现了问题Msg
我用这个改变了
<resourceModel>Test_mysql4</resourceModel>
并且工作