如何访问 Zend_Framework 中默认模块中的模型?
我正在尝试使用 Zend Framework 中的模块使我的应用程序模块化。
这是我的新项目结构:
<块引用> <前><代码>配置/ 应用程序.ini 布局/ 过滤器/ 帮手/ 脚本/ 模块/ 默认/ 表格/ 控制器/ 型号/ 观点/ 行政/ 表格/ 控制器/ 型号/ 观点/ Bootstrap.php
我已在应用程序 .ini 中添加了这些行:
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.prefixDefaultModule = false
resources.modules[] =
现在,我可以访问默认目录中的控制器和视图,而无需更改之前配置中的任何内容(我刚刚将控制器/模型/视图移至 module/ 目录中)。
但是,我无法访问默认模块中的模型。
这是当我尝试从控制器访问该模型时显示的错误:
致命错误:在第 138 行 /var/www/.../application/modules/default/controllers/AccountController.php 中找不到类“Model_Account_Edit”
知道吗?
I'm trying to make my application modular using modules in Zend Framework.
Here is my new project structure:
configs/ application.ini layouts/ filters/ helpers/ scripts/ modules/ default/ forms/ controllers/ models/ views/ admin/ forms/ controllers/ models/ views/ Bootstrap.php
I've added these lines in my application .ini:
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.prefixDefaultModule = false
resources.modules[] =
I can now access the controllers and views in the default directory without changing anything in my previous configuration (I just moved my controllers/models/views into the module/ directory).
However, I can't access to models located in the default module.
Here is the error displayed when I tried to access to this model from a controller:
Fatal error: Class 'Model_Account_Edit' not found in /var/www/.../application/modules/default/controllers/AccountController.php on line 138
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是因为您缺少特定于模块的引导程序。
向每个模块添加一个引导程序文件,它应该可以工作。该类应如下所示:
将其添加到项目中
并且您应该准备好开始。
It's probably because you're missing a module specific bootstrap.
Add a bootstrap file to each module and it should work. The class should look something like this:
Add it to the project
And you should be ready to go.