有没有办法为每个模块建立模型?我有 3 个模块,一个是“联系人”模块。
我在 modules/contacts/models/Codes.php 中为它创建了一个模型
代码 Controller
class Contacts_CodesController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function indexAction()
{
$codesTable = new Contacts_Model_Codes();
}
代码型号:
class Contacts_Model_Codes extends Zend_Db_Table
{
protected $_name = 'codes';
}
我得到的错误:
fatal error :在第 26 行的/Applications/MAMP/htdocs/zf_site/application/modules/contacts/controllers/CodesController.php 中找不到类“Contacts_Model_Codes”
谢谢
最佳答案
我发现了问题。我忘记在我的联系人模块中放入一个引导文件。
现在一切正常,我可以让我的模块使用它们自己的模型。
class Contacts_Bootstrap extends Zend_Application_Module_Bootstrap
{
}
关于zend-framework - Zend Framework模块化app,不能为每个模块加载模型,自动加载模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1523515/