zend-framework - Zend Framework模块化app,不能为每个模块加载模型,自动加载模型?

标签 zend-framework model module

有没有办法为每个模块建立模型?我有 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/

相关文章:

python - 导入错误:没有名为 pynotify 的模块。安装模块时

module - 跨模块的类型定义

zend-framework - Zend rest Controller 路由到特定 Controller

mysql - 连接两个表的 Zend_Db 查询

php - 使用 Zend_Mail 时添加 PDF 附件

AngularJS 将值复制到另一个输入

php - 如何在 Zend Framework 中启用我的模块?

zend-framework - Zend 单选元素装饰器

ruby-on-rails - 如何在 Rails 模型中运行 "do" block ,同时仍列出 :dependent?

python - 如何从破折号下拉菜单中选择并运行模型并更新混淆矩阵图?