zend modules models

前端 未结 3 1693
深忆病人
深忆病人 2020-12-21 13:22

My application setup with 2 modules admin and default I test the controller which works fine on modules

but the models doesnt work

I created a model applica

相关标签:
3条回答
  • 2020-12-21 13:22

    Are you using an autoloader?

    If you do you should change the class name (or path) to reflect the path (or class name)

    Models <> Model

    You should have

    Admin_Model_User in admin/model/user.php

    or

    Admin_Models_User in admin/models/user.php.

    0 讨论(0)
  • 2020-12-21 13:34

    Configure an autoloader so that the framework can map your class prefix Admin_Model to the corresponding source path. This is not done automatically.

    I suggest reading the part on models of the Zend Framework Quickstart, which explains in detail how to do this.

    0 讨论(0)
  • 2020-12-21 13:48

    Essentially, you need 2 lines in the application.ini file;

    resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
    resources.modules[] = ""
    

    Then, for each module, you need a module bootstrap file:

    File: myproject/application/modules/{modulename}/Bootstrap.php

    <?php
    
    class {Modulename}_Bootstrap extends Zend_Application_Module_Bootstrap
    {
    }
    

    (Yes, it is an empty class.)

    Further details are at http://akrabat.com/zend-framework/bootstrapping-modules-in-zf-1-8/.

    0 讨论(0)
提交回复
热议问题